Post increment

<?php
$a = 4;
echo $a+++$a++;
?>

What is the output?
Answer: 9. The first $a++ looks up 4, then increments $a. The second $a++ looks up 5, then increments $a. 4 + 5 = 9. $a now contains 6.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.