Re: incrementing a number from a text file

From: Date: Fri, 11 Mar 2005 16:46:36 +0000
Subject: Re: incrementing a number from a text file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210515@lists.php.net to get a copy of this message
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: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.general (#210515) next »