3v4l.org

run code in 200+ PHP versions simultaneously
<?php class test { public function __construct(array $values) { print_r($values); } public static function getInstance($db) { $result = $db->query("SELECT * from test"); var_dump($result); return new test($result->fetchArray(SQLITE3_ASSOC)); } } $db = new SQLite3(":memory:", SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE); $db->query("CREATE TABLE test (foo, bar)"); test::getInstance($db); print "done"; ?>

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for branch php-master
object(SQLite3Result)#3 (0) { } Fatal error: Uncaught TypeError: Argument 1 passed to test::__construct() must be of the type array, bool given, called in /in/UFnes on line 10 and defined in /in/UFnes:3 Stack trace: #0 /in/UFnes(10): test->__construct(false) #1 /in/UFnes(17): test::getInstance(Object(SQLite3)) #2 {main} thrown in /in/UFnes on line 3
Process exited with code 255.
Output for branch php-master+opcache
object(SQLite3Result)#3 (0) { } Fatal error: Uncaught TypeError: Argument 1 passed to test::__construct() must be of the type array, bool given, called in /in/UFnes on line 10 and defined in /in/UFnes:3 Stack trace: #0 /in/UFnes(10): test->__construct(false) #1 /in/UFnes(17): test::getInstance(Object(SQLite3)) #2 {main} thrown in /in/UFnes on line 3
Process exited with code 255.
Output for branch php-master+jit
object(SQLite3Result)#3 (0) { } Fatal error: Uncaught TypeError: Argument 1 passed to test::__construct() must be of the type array, bool given, called in /in/UFnes on line 10 and defined in /in/UFnes:3 Stack trace: #0 /in/UFnes(10): test->__construct(false) #1 /in/UFnes(17): test::getInstance(Object(SQLite3)) #2 {main} thrown in /in/UFnes on line 3
Process exited with code 255.
Output for Typed properties v2
object(SQLite3Result)#3 (0) { } Fatal error: Uncaught TypeError: Argument 1 passed to test::__construct() must be of the type array, bool given, called in /in/UFnes on line 10 and defined in /in/UFnes:3 Stack trace: #0 /in/UFnes(10): test->__construct(false) #1 /in/UFnes(17): test::getInstance(Object(SQLite3)) #2 {main} thrown in /in/UFnes on line 3
Process exited with code 255.
Output for Arrow functions
object(SQLite3Result)#3 (0) { } Fatal error: Uncaught TypeError: Argument 1 passed to test::__construct() must be of the type array, boolean given, called in /in/UFnes on line 10 and defined in /in/UFnes:3 Stack trace: #0 /in/UFnes(10): test->__construct(false) #1 /in/UFnes(17): test::getInstance(Object(SQLite3)) #2 {main} thrown in /in/UFnes on line 3
Process exited with code 255.
Output for Object typehint
object(SQLite3Result)#3 (0) { } Fatal error: Uncaught TypeError: Argument 1 passed to test::__construct() must be of the type array, boolean given, called in /in/UFnes on line 10 and defined in /in/UFnes:3 Stack trace: #0 /in/UFnes(10): test->__construct(false) #1 /in/UFnes(17): test::getInstance(Object(SQLite3)) #2 {main} thrown in /in/UFnes on line 3
Process exited with code 255.
Output for Array change keys
object(SQLite3Result)#3 (0) { } Fatal error: Uncaught TypeError: Argument 1 passed to test::__construct() must be of the type array, boolean given, called in /in/UFnes on line 10 and defined in /in/UFnes:3 Stack trace: #0 /in/UFnes(10): test->__construct(false) #1 /in/UFnes(17): test::getInstance(Object(SQLite3)) #2 {main} thrown in /in/UFnes on line 3
Process exited with code 255.
Output for Lexical anon
object(SQLite3Result)#3 (0) { } Catchable fatal error: Argument 1 passed to test::__construct() must be of the type array, boolean given, called in /in/UFnes on line 10 and defined in /in/UFnes on line 3
Process exited with code 255.

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page