3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*trait Foo { private $name = '123'; } class Bar { use Foo; private $name = '321'; public function getName(){echo $this->name;} } $bar = new Bar(); $bar->getName();*/ /*echo false; class Faz {} class Baz extends Faz {} interface Foo {public function du(Faz $param);} class A implements Foo { public function du(Baz $param){ echo false; } }*//* $i = 5; echo $i++; echo $i;*/ namespace Bar; function strlen($string){return 5;} namespace Foo; use Bar; echo strlen('Baz'); var_dump(array_values(true));
Output for 8.3.0 - 8.3.6
3 Fatal error: Uncaught TypeError: array_values(): Argument #1 ($array) must be of type array, true given in /in/Pgmla:40 Stack trace: #0 /in/Pgmla(40): array_values(true) #1 {main} thrown in /in/Pgmla on line 40
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
3 Fatal error: Uncaught TypeError: array_values(): Argument #1 ($array) must be of type array, bool given in /in/Pgmla:40 Stack trace: #0 /in/Pgmla(40): array_values(true) #1 {main} thrown in /in/Pgmla on line 40
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
3 Warning: array_values() expects parameter 1 to be array, bool given in /in/Pgmla on line 40 NULL
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33
3 Warning: array_values() expects parameter 1 to be array, boolean given in /in/Pgmla on line 40 NULL
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_STRING in /in/Pgmla on line 32
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, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING in /in/Pgmla on line 32
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/Pgmla on line 32
Process exited with code 255.

preferences:
230.91 ms | 401 KiB | 310 Q