Search code examples
phplanguage-features

Strange variable assignment


I have a code:

<?php
echo $var=@E��Sᴦt��Pט㘦�j옦^'"ɘҘ=�^X��5';
?>

It will output 'gzinflate'. How did it happen? I think this is some feature of php when working with strings, but what?

Code in correct encoding (ASCII), but have a lot of special symbols. If the code is broken, try download txt file http://content.wuala.com/contents/dador/web/code.txt with it.


Solution

  • The code

    echo $var=@E³»Sát ôPטã…jì^'"ÉÒ=‡ ñ€5';
    boils down to

    echo             // ...
    $var             // ...
    =                // ...
    @                // error supressor
    E³»Sát ôPטã…jì  // an undefined constant, treated as a string
    ^                //  xor
    '"ÉÒ=‡ ñ€5'      // another string literal
    

    and the resulting string is just gzinflate