You are here: Re: $i++ problem understanding « All PHP « IT news, forums, messages
Re: $i++ problem understanding

Posted by lain on 10/13/81 11:28

Pugi! wrote:
> Currently I am studying PHP.
>
> I can understand the following :
> $a = 10;
> $b = $a++;
> print("$a, $b");
> will print 11, 10 on the screen.

just wrong.
what happens is:
$b = $a;
$a++;

so the above example actually will print ("10, 10"). understanding this
will also help you understanding the other example of yours. $a++ is
called "post increment" which means incrementing AFTER using the value
of this. of course there is also "pre increment" as of ++$a which will
do the opposite: incrementing the value and then use it for the
expression.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация