3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array1 = array( array('ur_user_id'=> 1,'ur_fname'=>'PerA','ur_lname'=>'SonA'), array('ur_user_id'=> 2,'ur_fname'=>'PerB','ur_lname'=>'SonB'), array('ur_user_id'=> 3,'ur_fname'=>'PerC','ur_lname'=>'SonC'), ); $array2 = array( array('ur_user_id' => 5,'ur_code' => 'EE','ur_user_role' => 'testE'), array('ur_user_id' => 4,'ur_code' => 'DD','ur_user_role' => 'testD'), array('ur_user_id' => 6,'ur_code' => 'FF','ur_user_role' => 'testF'), array('ur_user_id' => 3,'ur_code' => 'CC','ur_user_role' => 'testC'), array('ur_user_id' => 1,'ur_code' => 'AA','ur_user_role' => 'testA'), array('ur_user_id' => 2,'ur_code' => 'BB','ur_user_role' => 'testB'), ); usort($array2,function($a,$b){ return strnatcmp($a['ur_user_id'],$b['ur_user_id']); }); print_r(array_uintersect($array2,$array1,function($a,$b){ return strnatcmp($a['ur_user_id'],$b['ur_user_id']); }));
based on mhvL9
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0alpha1
Array ( [0] => Array ( [ur_user_id] => 1 [ur_code] => AA [ur_user_role] => testA ) [1] => Array ( [ur_user_id] => 2 [ur_code] => BB [ur_user_role] => testB ) [2] => Array ( [ur_user_id] => 3 [ur_code] => CC [ur_user_role] => testC ) )