sasori Posted July 3, 2009 Share Posted July 3, 2009 hi, I was reviewing functions in php, and then i bumped into this array_diff_uassoc function, it doesn't give much example on the online manual. I was trying to compare the first array to 2 different arrays. on the manual it says this function can accept 1 or more arrays to compare against but then I am receiving this error Warning: Missing argument 3 for key_compare_func() in C:\xampp\htdocs\practice\test2\test2.php on line 7 and here's my code $a = array("a"=>"apple","b"=>"banana","d"=>"carrot","f"=>"fuck"); $b = array("a"=>"apple","b"=>"banana","c"=>"carrot","f"=>"fuck"); $c = array("a"=>"apple","b"=>"banana","e"=>"carrot","fuck"); function key_compare_func($a,$b,$c){ if($a === $b){ return 0; } if($a === $c){ return 0; } if(($a > $b) && ($a > $c)){ return 1; }else{ return -1; } } echo "<pre>",print_r(array_diff_uassoc($a,$b,$c,"key_compare_func")),"</pre>"; please help me out.TIA. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.