3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Set { public function __construct(array $spec, $arg1 = null, $arg2 = null) { if (isset($spec[0]) && is_array($spec[0]) { // was called like Set::createFromArray([['foo'=>'bar'], false, 64]); } else { // was called like new Set(['foo'=>'bar'], false, 64) } } } class SetFactory { public function create(array $map, $arg1, $arg2) { return new Set($map, $arg1, $arg2); } public function createFromArray(array $spec) { return new Set($spec); } }
Output for 5.3.0 - 5.5.2
Parse error: syntax error, unexpected '{' in /in/OXgTk on line 7
Process exited with code 255.