+ 2

What is the difference between post and pre increment ++5 and 5++??

What is the difference between post and pre increment ++5 and 5++??

18th Nov 2016, 7:01 AM
Rohan Shrestha
Rohan Shrestha - avatar
2 Antworten
+ 2
(++x increase the value and thn update it) like x=5 and ++x ++ = 6 now and thn 6 updated to x so if we print x it will give you output of 6 but (x++ it update the value like x=5 and x++ so x = 5 and thn it increases it to 1 so =6 but it didn't update rhe value so x still left 5
18th Nov 2016, 2:24 PM
Dhruv Saxena
Dhruv Saxena - avatar
0
<?php echo ++5; //will output 6 echo 5++; // will output 5 ?>
18th Nov 2016, 7:50 AM
Mohammad Gholami
Mohammad  Gholami - avatar