3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fake_db_results = [ ['session_id' => 1, 'page_url' => 'http://a.com'], ['session_id' => 1, 'page_url' => 'http://b.com'], ['session_id' => 1, 'page_url' => 'http://c.com'], ['session_id' => 2, 'page_url' => 'http://d.com'], ['session_id' => 2, 'page_url' => 'http://e.com'], ['session_id' => 3, 'page_url' => 'http://f.com'], ['session_id' => 4, 'page_url' => 'http://g.com'], ['session_id' => 5, 'page_url' => 'http://h.com'] ]; $paths = []; foreach ($fake_db_results as $row) { array_push($paths[$row['session_id']], $row['page_url']); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /in/aCsWi:16 Stack trace: #0 /in/aCsWi(16): array_push(NULL, 'http://a.com') #1 {main} thrown in /in/aCsWi on line 16
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

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


preferences:
173.33 ms | 405 KiB | 5 Q