What does $i++ in PHP mean?

For example, look at this code: for ($i = 0; $i < 5; $i++){ } What does $i++ mean?

Answer #1

Double plus means increase by 1. It’s telling the compiler that every time the for loop runs through, add 1 to i, or do $i = $i + 1.

Also, if you wanted to, you could make it decrease by 1 every time by using $i–.

Answer #2

Thank You, that explains it. :)

Answer #3

Hi, It means that compiler will give you output 01234, I mean to say this program is telling to compiler that it should add 1 to the value of $i till it is less than 5. For More Info. Please visit: http://funadvice.com/r/15o4078gvip http://funadvice.com/r/15o4078h1j7

More Like This
Ask an advisor one-on-one!
Advisor

Developer Helps

Web Development, Programming, Software Development

Advisor

Web Development India

Web Development, PHP Development, Website Development

Advisor

Developer Helps

Web Development, Programming, PHP

Advisor

Website Pandas

Web Development, Software Development, IT Services

Advisor

ADN Diginet | Cloud

Cloud Services, Web Hosting, Online Presence Management