3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //$in2 = Closure::bind(function () {$this->ruler = 'jesus';}, $inst, get_class($inst)); class Singleton { protected static $instance; // object instance private function __construct(){ /* ... @return Singleton */ } // Защищаем от создания через new Singleton private function __clone() { /* ... @return Singleton */ } // Защищаем от создания через клонирование private function __wakeup() { /* ... @return Singleton */ } // Защищаем от создания через unserialize public static function getInstance() { // Возвращает единственный экземпляр класса. @return Singleton if ( !isset(self::$instance) ) { $class = __CLASS__; self::$instance = new $class(); self::$instance->id = mt_rand(1,1000); } return self::$instance; } public function doAction() { echo $this->id; } } $singy = Singleton::getInstance(); $singy->doAction(); $singy2 = Singleton::getInstance(); $derp = Closure::bind(function () {$this->id = 'HACKED';}, $singy2, get_class($singy2)); $derp(); $singy2->doAction();
Output for 7.1.0
587HACKED
Output for 5.4.32, 7.0.14
110HACKED
Output for 7.0.10
870HACKED
Output for 7.0.9
892HACKED
Output for 7.0.8
189HACKED
Output for 7.0.7
946HACKED
Output for 7.0.6
471HACKED
Output for 7.0.5
938HACKED
Output for 7.0.4
739HACKED
Output for 7.0.3
392HACKED
Output for 7.0.2
925HACKED
Output for 7.0.1
157HACKED
Output for 5.4.4, 5.6.5, 7.0.0
477HACKED
Output for 5.6.28
183HACKED
Output for 5.6.25
146HACKED
Output for 5.6.24
325HACKED
Output for 5.6.23
415HACKED
Output for 5.6.22
642HACKED
Output for 5.6.10, 5.6.21
229HACKED
Output for 5.6.20
678HACKED
Output for 5.6.19
267HACKED
Output for 5.6.18
205HACKED
Output for 5.6.17
939HACKED
Output for 5.6.16
47HACKED
Output for 5.6.15
363HACKED
Output for 5.6.14
926HACKED
Output for 5.6.13
774HACKED
Output for 5.6.12
49HACKED
Output for 5.6.11
911HACKED
Output for 5.6.9
470HACKED
Output for 5.6.8
522HACKED
Output for 5.6.7
651HACKED
Output for 5.6.6
495HACKED
Output for 5.6.4
533HACKED
Output for 5.6.3
867HACKED
Output for 5.6.2
498HACKED
Output for 5.6.1
560HACKED
Output for 5.6.0
168HACKED
Output for 5.5.38
403HACKED
Output for 5.4.5, 5.5.37
334HACKED
Output for 5.5.36
817HACKED
Output for 5.5.35
257HACKED
Output for 5.5.34
65HACKED
Output for 5.5.33
761HACKED
Output for 5.5.32
630HACKED
Output for 5.5.31
484HACKED
Output for 5.5.30
912HACKED
Output for 5.5.29
31HACKED
Output for 5.5.10, 5.5.28
280HACKED
Output for 5.5.27
715HACKED
Output for 5.5.26
167HACKED
Output for 5.5.25
595HACKED
Output for 5.5.24
951HACKED
Output for 5.5.23
589HACKED
Output for 5.5.22
374HACKED
Output for 5.5.21
286HACKED
Output for 5.5.20
956HACKED
Output for 5.5.19
55HACKED
Output for 5.5.18
79HACKED
Output for 5.5.16
133HACKED
Output for 5.5.15
156HACKED
Output for 5.5.14
502HACKED
Output for 5.5.13
930HACKED
Output for 5.4.25, 5.5.12
448HACKED
Output for 5.5.11
71HACKED
Output for 5.5.9
240HACKED
Output for 5.4.18, 5.5.8
541HACKED
Output for 5.5.7
207HACKED
Output for 5.5.6
545HACKED
Output for 5.5.5
452HACKED
Output for 5.5.4
338HACKED
Output for 5.5.3
220HACKED
Output for 5.5.2
366HACKED
Output for 5.5.1
716HACKED
Output for 5.5.0
625HACKED
Output for 5.4.45
91HACKED
Output for 5.4.44
517HACKED
Output for 5.4.43
644HACKED
Output for 5.4.42
492HACKED
Output for 5.4.41
695HACKED
Output for 5.4.40
297HACKED
Output for 5.4.39
143HACKED
Output for 5.4.7, 5.4.38
404HACKED
Output for 5.4.37
368HACKED
Output for 5.4.36
988HACKED
Output for 5.4.35
270HACKED
Output for 5.4.34
69HACKED
Output for 5.4.31
433HACKED
Output for 5.4.30
895HACKED
Output for 5.4.29
128HACKED
Output for 5.4.28
227HACKED
Output for 5.4.27
940HACKED
Output for 5.4.26
791HACKED
Output for 5.4.24
785HACKED
Output for 5.4.23
289HACKED
Output for 5.4.22
100HACKED
Output for 5.4.21
425HACKED
Output for 5.4.20
139HACKED
Output for 5.4.19
562HACKED
Output for 5.4.17
76HACKED
Output for 5.4.16
109HACKED
Output for 5.4.15
63HACKED
Output for 5.4.14
800HACKED
Output for 5.4.13
465HACKED
Output for 5.4.12
46HACKED
Output for 5.4.11
712HACKED
Output for 5.4.10
310HACKED
Output for 5.4.9
23HACKED
Output for 5.4.8
751HACKED
Output for 5.4.6
797HACKED
Output for 5.4.3
127HACKED
Output for 5.4.2
266HACKED
Output for 5.4.1
569HACKED
Output for 5.4.0
250HACKED
Output for 5.3.29
137 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.28
843 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.27
394 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.26
999 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.25
437 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.24
231 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.23
848 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.22
675 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.21
460 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.20
831 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.19
547 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.18
743 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.17
842 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.16
448 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.15
307 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.14
268 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.13
893 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.12
758 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.11
682 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.10
560 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.9
275 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.8
242 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.7
644 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.6
288 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.5
392 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.4
880 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.3
552 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.2
923 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.1
489 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.3.0
185 Fatal error: Call to undefined method Closure::bind() in /in/75DPr on line 26
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/75DPr on line 26
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/75DPr on line 26
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/75DPr on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/75DPr on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/75DPr on line 7
Process exited with code 255.