Re: Increment
| From: | Robert V. Zwink | Date: | Thu, 29 Jun 2000 21:50:17 +0000 |
| Subject: | Re: Increment | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3906@lists.php.net to get a copy of this message | ||
You are check the value to "blue", should be checking the value of "$blue"
In your example, the if statement will never evaluate true, and $i will
never increment.
Either
$i++
or
++$i
try something like:
<?
$i =1;
echo $i++;
$i=1;
echo ++$i;
?>
Both are correct it just depends on when you want to check the value.
-Rob Z.
----- Original Message -----
From: "Peter Benoit" <pbenoit@triton-network.com>
To: "PHP-General" <php-general@lists.php.net>
Sent: Thursday, June 29, 2000 5:34 PM
Subject: [PHP] Increment
> $i = 1;
>
> for(whatever){
> $i++;
> }
>
> echo $i
>
> I want $i to increment, how is this done correctly in PHP?
>
> TIA,
> Peter
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>