php - if two array has identical values in same format irrespective of key without using any loop -
array1 = (a=>1, b=>2, c=>3, d=>1 ) array2 = (g=>1, d=>2, f=>3, e=>1 )
i cannot use ===
operator keys different. above 2 arrays has same value format, want display yes if have, can run loop want avoid part.
you may looking array_values()
:
<?php $array1 = ['a'=>1 ,'b'=>2, 'c'=>3, 'd'=> 1]; $array2 = ['g'=>1 ,'d'=>2, 'f'=>3, 'e'=> 1]; var_dump(array_values($array1)===array_values($array2)); // bool(true) ?>
Comments
Post a Comment