+ 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++??
2 Respostas
+ 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
0
<?php
echo ++5; //will output 6
echo 5++; // will output 5
?>