3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($a) { if (!is_array($a) && ! $a instanceof \Traversable) { throw new \Exception("here"); } return implode(' ', $a); } $traversable = new ArrayObject(); $traversable['test'] = 'that'; echo test(['a', 'b', 'c']); echo test($traversable);

preferences:
43.48 ms | 402 KiB | 5 Q