0

If $a is and $a++ gives same value then whats the point of that operation?

5th Nov 2015, 12:25 PM
Metaphor_
Metaphor_ - avatar
2 Antworten
+ 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.
5th Aug 2016, 11:35 AM
Sumitabha Banerjee
Sumitabha Banerjee - avatar
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.
9th Dec 2015, 1:16 PM
Pratik Lalan
Pratik Lalan - avatar