Hacker News new | ask | show | jobs
by zackattack 5698 days ago
'z'++ is not 'aa'. 'z'++ is not even valid PHP. $z='z';$p=$z++; does nothing either.

it's only in the for-loop context.

2 comments

Not really, after $p = $z++ $p is 'z', $z is 'aa', as you'd kind-of expect. But the difference between literals and expressions/variable references of course just adds icing to the cake of bizareness.
try...

<?php $z='z'; echo ++$z;

which produces 'aa'