Blog

PHP on Crack

I had a chuckle while reading Ed Finkler’s PHP6 wish list. After reading the (long since deleted) comment by Damien Seguy I almost fell off my chair.

Try running the following code under PHP

<?php
${'!@#$%^&*()[]:;"<>,./?'} = "i bet this won't work!<br>\n";
${"omg???!!! wtf???!!! :D"} = "omg it does<br>\n";
echo ${'!@#$%^&*()[]:;"<>,./?'} . ${"omg???!!! wtf???!!! :D"};

It worked here on PHP 5.2.3 with ubuntu security fixes. I got

i bet this won't work!
omg it does<br>

This contradicts the PHP manual, but hey it works.

Tags