3v4l.org

run code in 300+ PHP versions simultaneously
<?php class G { public $prefixes = array(); public function test($prefix, $baseDir) { if (!isset($this->prefixes[$prefix])) { $this->prefixes[$prefix] = []; } array_push($this->$prefixes[$prefix], $baseDir); } } $l = new G(); $l->test("a", "b"); var_dump($l);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $prefixes in /in/AlJ1F on line 10 Deprecated: Creation of dynamic property G::$ is deprecated in /in/AlJ1F on line 10 Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /in/AlJ1F:10 Stack trace: #0 /in/AlJ1F(10): array_push(NULL, 'b') #1 /in/AlJ1F(14): G->test('a', 'b') #2 {main} thrown in /in/AlJ1F on line 10
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:
55.43 ms | 401 KiB | 8 Q