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 () {return new get_class($this);}, $singy2, get_class($singy2)); $singy2 = $derp(); $singy2->doAction(); $singy->doAction();
Output for 7.1.0
436 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.14
308 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.11
668 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.10
548 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.9
826 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.8
426 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.7
602 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.6
361 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.5
766 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.4
255 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.3
319 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.2
174 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.1
665 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for 7.0.0
799 Fatal error: Uncaught Error: Class 'get_class' not found in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Singleton->{closure}() #1 {main} thrown in /in/R0VsR on line 26
Process exited with code 255.
Output for hhvm-3.13.2
400 Fatal error: Uncaught Error: Class undefined: get_class in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Closure$doAction() #1 {main}
Process exited with code 255.
Output for hhvm-3.12.0
746 Fatal error: Uncaught Error: Class undefined: get_class in /in/R0VsR:26 Stack trace: #0 /in/R0VsR(27): Closure$doAction() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0
672 Fatal error: Class undefined: get_class in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.23, 5.6.28
472 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.26
18 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.25
519 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.24
524 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.22
199 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.21
569 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.20
418 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.19
401 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.18
90 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.17
621 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.16
774 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.15
932 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.14
960 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.13
776 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.12
480 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.11
371 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.10
750 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.25, 5.6.9
389 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.22, 5.6.8
89 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.7
990 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.6
327 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.5
424 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.4
719 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.3
145 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.2, 5.6.2
577 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.1
53 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.6.0
276 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.38
595 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.37
695 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.36
731 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.35
915 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.34
619 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.33
633 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.3, 5.5.32
438 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.31
650 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.30
394 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.29
582 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.1, 5.5.28
850 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.27
170 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.26
948 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.24
647 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.23
228 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.21
55 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.20
341 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.19
864 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.18
814 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.16
125 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.15
28 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.14
37 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.13
497 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.12
703 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.11
884 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.10
101 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.9
699 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.8
64 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.7
993 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.6
560 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.5
131 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.4
561 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.2
277 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.1
406 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.5.0
925 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.45
722 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.44
26 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.43
756 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.42
604 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.41
426 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.40
599 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.39
967 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.38
225 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.37
846 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.36
328 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.35
885 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.34
877 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.32
927 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.31
862 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.30
342 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.29
942 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.28
266 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.27
532 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.26
260 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.25
461 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.24
975 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.23
738 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.22
469 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.21
916 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.20
963 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.19
641 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.18
980 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.17
912 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.16
709 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.15
296 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.14
856 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.13
443 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.12
466 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.11
755 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.10
754 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.9
257 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.8
839 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.7
566 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.6
999 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.5
979 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.4
194 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.3
696 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.4.0
57 Fatal error: Class 'get_class' not found in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.29
389 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.28
973 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.27
196 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.26
33 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.25
385 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.24
861 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.23
288 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.22
536 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.21
428 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.20
4 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.19
741 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.18
538 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.17
276 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.16
479 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.15
719 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.14
309 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.13
287 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.12
635 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.11
687 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.10
168 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.9
711 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.8
853 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.7
827 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.6
801 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.5
688 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.4
455 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.3
301 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.2
605 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.1
155 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR on line 26
Process exited with code 255.
Output for 5.3.0
29 Fatal error: Call to undefined method Closure::bind() in /in/R0VsR 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/R0VsR 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/R0VsR 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/R0VsR 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/R0VsR 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/R0VsR on line 7
Process exited with code 255.