3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $newarray = array('489289', '536516', '332833', '536516'); $rockin = array( '489289' => array('536516','value1'), '332833' => array('536516'), ); foreach ($rockin as $array) { foreach ($array as $value) { if (in_array($value, $newarray)) { $newarray = array_diff($newarray, array(array_keys($value))); break; } } } var_dump($newarray);
Output for 5.3.28 - 5.3.29, 5.4.20 - 5.6.28, 7.0.0 - 7.1.0
Warning: array_keys() expects parameter 1 to be array, string given in /in/ueC6o on line 13 Warning: array_keys() expects parameter 1 to be array, string given in /in/ueC6o on line 13 array(4) { [0]=> string(6) "489289" [1]=> string(6) "536516" [2]=> string(6) "332833" [3]=> string(6) "536516" }
Output for hhvm-3.10.0 - 3.12.0
Warning: array_keys() expects parameter 1 to be an array or collection in /in/ueC6o on line 13 Warning: array_keys() expects parameter 1 to be an array or collection in /in/ueC6o on line 13 array(4) { [0]=> string(6) "489289" [1]=> string(6) "536516" [2]=> string(6) "332833" [3]=> string(6) "536516" }
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19
Warning: array_keys() expects parameter 1 to be array, string given in /in/2X7dd on line 13 Warning: array_keys() expects parameter 1 to be array, string given in /in/2X7dd on line 13 array(4) { [0]=> string(6) "489289" [1]=> string(6) "536516" [2]=> string(6) "332833" [3]=> string(6) "536516" }
Output for 4.3.2 - 5.2.17
Warning: array_keys(): The first argument should be an array in /in/2X7dd on line 13 Warning: array_keys(): The first argument should be an array in /in/2X7dd on line 13 array(4) { [0]=> string(6) "489289" [1]=> string(6) "536516" [2]=> string(6) "332833" [3]=> string(6) "536516" }
Output for 4.3.1
Warning: array_keys() [http://www.php.net/function.array-keys]: The first argument should be an array in /in/2X7dd on line 13 Warning: array_keys() [http://www.php.net/function.array-keys]: The first argument should be an array in /in/2X7dd on line 13 array(4) { [0]=> string(6) "489289" [1]=> string(6) "536516" [2]=> string(6) "332833" [3]=> string(6) "536516" }
Output for 4.3.0
Warning: array_keys() [http://www.php.net/function.array-keys]: The first argument should be an array in /in/ueC6o on line 13 Warning: array_keys() [http://www.php.net/function.array-keys]: The first argument should be an array in /in/ueC6o on line 13 array(4) { [0]=> string(6) "489289" [1]=> string(6) "536516" [2]=> string(6) "332833" [3]=> string(6) "536516" }