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 5.5.24 - 5.5.30, 5.6.8 - 5.6.16, 7.0.0
Parse error: syntax error, unexpected 'prefixes' (T_STRING), expecting variable (T_VARIABLE) in /in/rEgba on line 4
Process exited with code 255.

preferences:
157.28 ms | 1399 KiB | 24 Q