Re: incrementing a number from a text file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Luis TQM Ariceaga wrote:
> Is it possible to let the OS handle the collisions?
>
> For example:
>
> $last_value = system('cat counter.txt', $retval);
> $last_value++;
> $result = system('echo $last_value > counter.txt', $retval);
>
> ....just a suggestion!
>

Luis: if the OS handled the read/write collisions then you could just
file_*_contents() and be done with it.  Unfortunately it's not that
simple in any situation where you might have more than one person trying
to access the same PHP page at *exactly* the same time.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux