Re[2]: [PHP] Simple: Whats wrong with this?
Hello Jake, Wednesday, March 17, 2004, 5:00:52 PM, you wrote: $correct++; JM Does this always work? In my timesheet app, I have to do $counter = $counter JM + 1, because for some reason the $counter++; doesn't work. It just doesn't JM work, no incrementation of the variable. Is there something in php.ini that JM can prohibit this from working? ++ is a _post_ increment. This means it'll returns $correct first and then increment it by one. There is a section in the PHP manual on this (search for Incrementing/Decrementing Operators. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Simple: Whats wrong with this?
Hello Sam, Wednesday, March 17, 2004, 5:04:21 PM, you wrote: SM This drove me nuts for a while and instead of doing $variable++ I SM started using ++$variable and never had the problem again. Yes, that's a pre-increment operator. Quite different to a post-increment. You need to use the right one depending if your variable exists already, etc. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Simple: Whats wrong with this?
On Thursday 18 March 2004 01:07, Richard Davey wrote: ++ is a _post_ increment. This means it'll returns $correct first and then increment it by one. There is a section in the PHP manual on this (search for Incrementing/Decrementing Operators. Whether it's pre or post depends on whether it is placed before the variable in question or after. $doo++ !== ++$doo -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Marxist Law of Distribution of Wealth: Shortages will be divided equally among the peasants. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Simple: Whats wrong with this?
On Wed, 2004-03-17 at 12:19, Jason Wong wrote: On Thursday 18 March 2004 01:07, Richard Davey wrote: ++ is a _post_ increment. This means it'll returns $correct first and then increment it by one. There is a section in the PHP manual on this (search for Incrementing/Decrementing Operators. Whether it's pre or post depends on whether it is placed before the variable in question or after. $doo++ !== ++$doo But ++$doo === $doo++ *heheh* Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php