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)) { array_diff($newarray, $value); break; } } } var_dump($newarray);
Output for 4.3.2 - 7.1.0
Warning: array_diff(): Argument #2 is not an array in /in/ds6eQ on line 13 Warning: array_diff(): Argument #2 is not an array in /in/ds6eQ 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 - 4.3.1
Warning: array_diff() [http://www.php.net/function.array-diff]: Argument #2 is not an array in /in/ds6eQ on line 13 Warning: array_diff() [http://www.php.net/function.array-diff]: Argument #2 is not an array in /in/ds6eQ on line 13 array(4) { [0]=> string(6) "489289" [1]=> string(6) "536516" [2]=> string(6) "332833" [3]=> string(6) "536516" }