I have following two array
$array1 = array("product_a" => "Nokia1", "product_b" => "Nokia11", "product_c" => "Nokia111", "Nokia1111"); $array2 = array("product_a" => "Nokia1", "Samsung", "Nokia1111");
I want to compare these both array and want output as having different keys
Like my output as below
Array ( [product_b] => Nokia11 [product_c] => Nokia111 [0] => Nokia1111 )
is there any default php method available to compare?
I think that you can try
function key_compare_func($a, $b) { if ($a === $b) { return 0; } return ($a > $b)? 1:-1; }
You can get some reference with following link too,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.