3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php /* Rules / notes / hints: 1. No use of Reflection API / runkit extension 2. No stopping execution 3. No PHP errors / notices 3. Requires PHP 5.4+ 4. Use PHP's magic methods */ class Test { private $secret = 'Nyy lbhe Onfr ner orybat gb hf.'; private $callback; final public function run() { call_user_func($this->callback); return $this->secret . PHP_EOL; } public function __set($k, $v) { $key = $v[($v[$v])]; // it's some kind of weird array $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here class Fixer extends ArrayObject { public function offsetGet($i) { return 'callback'; } public function __invoke() { $fix = function() { $this->secret = str_rot13($this->secret); }; return $fix->bindTo($GLOBALS['test'], 'Test'); } } $test->foo = new Fixer; // end editing here echo $test->run();
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '<' in /in/d3dkW on line 3
Process exited with code 255.

preferences:
181.54 ms | 1395 KiB | 62 Q