Why the values of variable in PHP does not have a consistent behavior in following code?
<?php $piece = 10; // output is 10 10 10 10 11 12 echo $piece . $piece . $piece . $piece++ . $piece . ++$piece; $piece = 10; // output is 10 10 10 11 12 echo $piece . $piece . $piece++ . $piece . ++$piece; $piece = 10; // output is 11 10 11 12 echo $piece . $piece++ . $piece . ++$piece; ?> The question is why is the first output in the last example equal to 11? instead of 10 as it give in above 2 examples.
$piecein the third block. Or maybe the post-increment in the third block is responsible, in which case, the inconsistency between the examples is not explained.