3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array( array('status'=>'OK','Productname'=>'test1'), array('status'=>'OK','Productname'=>'test1'), array('status'=>'OK','Productname'=>'test2'), array('status'=>'OK','Productname'=>'test2') ); $notToDuplicate = array('test2'); $newArray = array_unique($arr, SORT_REGULAR); foreach($arr as $key => &$val) { if(!in_array($val['Productname'],$arr)) { var_dump(array_intersect($val, $newArray)); } }
Output for 5.4.0 - 7.1.0
Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 array(0) { } Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 array(0) { } Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 array(0) { } Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 Notice: Array to string conversion in /in/cb0jv on line 14 array(0) { }
Output for 5.2.9 - 5.3.29
array(0) { } array(0) { } array(0) { } array(0) { }
Output for 5.0.0 - 5.2.8
Warning: Wrong parameter count for array_unique() in /in/cb0jv on line 11 Warning: array_intersect(): Argument #2 is not an array in /in/cb0jv on line 14 NULL Warning: array_intersect(): Argument #2 is not an array in /in/cb0jv on line 14 NULL Warning: array_intersect(): Argument #2 is not an array in /in/cb0jv on line 14 NULL Warning: array_intersect(): Argument #2 is not an array in /in/cb0jv on line 14 NULL
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/cb0jv on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/cb0jv on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/cb0jv on line 12
Process exited with code 255.