3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( array( 'id' => 15, 'name' => 'John', 'color' => 'red', ), array( 'id' => 22, 'name' => 'Elise', 'color' => 'blue', ), array( 'id' => 30, 'name' => 'Mark', 'color' => 'red', ), ); $b = array( array( 'id' => 15, 'name' => 'Nancy', 'color' => 'black', ), array( 'id' => 20, 'name' => 'Elise', 'color' => 'blue', ), array( 'id' => 30, 'name' => 'Mark', 'color' => 'red', ), array( 'id' => 40, 'name' => 'John', 'color' => 'orange', ), ); function compare_ids($a, $b) { return ((bool)($a['id'] - $b['id'])); } print_r(array_intersect_uassoc($a, $b, "compare_ids"));
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Array to string conversion in /in/mV4nM on line 49 Notice: Array to string conversion in /in/mV4nM on line 49 Notice: Array to string conversion in /in/mV4nM on line 49 Notice: Array to string conversion in /in/mV4nM on line 49 Notice: Array to string conversion in /in/mV4nM on line 49 Notice: Array to string conversion in /in/mV4nM on line 49 Array ( [0] => Array ( [id] => 15 [name] => John [color] => red ) [1] => Array ( [id] => 22 [name] => Elise [color] => blue ) [2] => Array ( [id] => 30 [name] => Mark [color] => red ) )
Output for 5.0.0 - 5.3.29
Array ( [0] => Array ( [id] => 15 [name] => John [color] => red ) [1] => Array ( [id] => 22 [name] => Elise [color] => blue ) [2] => Array ( [id] => 30 [name] => Mark [color] => red ) )
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_intersect_uassoc() in /in/mV4nM on line 49
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_intersect_uassoc() in /in/mV4nM on line 49
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_intersect_uassoc() in /in/mV4nM on line 49