Re: Whacky increment/assignment logic with $foo++ vs ++$foo

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

 



On Fri, Oct 2, 2009 at 17:42, Daniel Brown <danbrown@xxxxxxx> wrote:
>
>    .... but rather by something just slightly more advanced:
>
> <?php
> $num = file_get_contents('visitcount.txt');
> if(isset($_GET['countme'])) {
>    echo "You are visitor #".++$num."<br />\n";
>    file_put_contents($num);
> }
> ?>

    Converse example (sorry, forgot to add it):

<?php
$num = file_get_contents('visitcount.txt');
if(isset($_GET['countme'])) {
    echo "There were ".$num++." people here before you.<br />\n";
    file_put_contents($num);
}
?>

-- 
</Daniel P. Brown>
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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