0
If $a is and $a++ gives same value then whats the point of that operation?
2 Respuestas
+ 1
When you are doing $b=$a++, You are doing two operations with one statement.
1. U are assigning the present value of a to b
2. U are incrementing a by 1 after the assignment.
Hence u are saving urself the extra typing.
0
Theres a point.
As ++$a is pre-increament. And $a++ is post-increament.
For example, think about your pre-paid mobile sim, and post-paid mobile.
In pre-paid first you recharge your number and then u have freedom to call. And in post paid, first you call and then you pay.
So when u excute ++$a, it first increases the number and then only execution goes further.
And in post, $a++, your number has been increased, but in the next execution you can see the difference/effect.
So this is the point.
hope you got me. If not, then do leave a reply.