3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo(&$foo, $bar) { $bar = explode(',', $bar); foreach ($bar as $baz) { if (!array_key_exists($baz, $foo)) { $foo[$baz] = $baz; } } } $foo = []; foo($foo, ''); foo($foo, 'foo,bar'); foo($foo, ''); var_dump($foo);
based on bFlnN
Output for 5.5.0 - 7.3.0beta1
array(3) { [""]=> string(0) "" ["foo"]=> string(3) "foo" ["bar"]=> string(3) "bar" }