3v4l.org

run code in 300+ PHP versions simultaneously
<?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.4.0
850HACKED
Output for 7.3.12
10HACKED
Output for 7.3.11
429HACKED
Output for 7.3.10
809HACKED
Output for 7.3.9
400HACKED
Output for 7.3.8
385HACKED
Output for 5.6.12, 7.3.7
49HACKED
Output for 7.3.6
488HACKED
Output for 7.3.5
933HACKED
Output for 7.3.4
163HACKED
Output for 7.3.3
861HACKED
Output for 7.3.2
959HACKED
Output for 7.3.1
699HACKED
Output for 7.3.0
628HACKED
Output for 7.2.25
921HACKED
Output for 7.2.24
450HACKED
Output for 7.2.23
653HACKED
Output for 7.2.22
340HACKED
Output for 5.6.23, 7.2.21
415HACKED
Output for 7.2.20
369HACKED
Output for 7.2.19
72HACKED
Output for 7.2.18
871HACKED
Output for 7.2.17
799HACKED
Output for 5.5.5, 7.2.13
452HACKED
Output for 7.0.9, 7.2.12
892HACKED
Output for 7.2.11
93HACKED
Output for 7.2.10
920HACKED
Output for 7.2.9
512HACKED
Output for 7.2.8
2HACKED
Output for 7.2.7
985HACKED
Output for 7.2.6
103HACKED
Output for 7.2.5
792HACKED
Output for 7.2.4
198HACKED
Output for 7.2.3
520HACKED
Output for 5.4.45, 7.2.2
91HACKED
Output for 7.2.1
199HACKED
Output for 7.2.0
655HACKED
Output for 7.1.33
323HACKED
Output for 7.1.32
14HACKED
Output for 7.1.31
185HACKED
Output for 7.1.30
124HACKED
Output for 7.1.29
327HACKED
Output for 7.1.28
906HACKED
Output for 7.1.27
438HACKED
Output for 7.0.6, 7.1.26
471HACKED
Output for 7.1.25
847HACKED
Output for 7.1.7
735HACKED
Output for 7.1.6
618HACKED
Output for 7.1.5
88HACKED
Output for 7.1.0
587HACKED
Output for 7.0.20
689HACKED
Output for 5.4.32, 7.0.14
110HACKED
Output for 7.0.10
870HACKED
Output for 7.0.8
189HACKED
Output for 7.0.7
946HACKED
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.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.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.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.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.1.6, 5.2.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.3.11, 4.4.0 - 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.

preferences:
180.59 ms | 401 KiB | 261 Q