I have this code that is looking for $array2 in $array1.
The issue that I have is that I need to lowercase both arrays so the in_array matching works and this code operates as expected but $array1 is greater than 20k objects -- is there anyway to do the lowercase without losing the array structure and looping?
$array1 = array(code => 200, status => success,
array(
'email' => 'Example1223@sample.com',
'status' => 'Pending'
),
array(
'email' => 'example123@sample.com',
'status' => 'Approved: Printed & Cleared'
),
array(
'email' => 'example23@sample.com',
'status' => 'Approved'
),
array(
'email' => 'Example22@sample.com',
'status' => 'Approved: Printed & Cleared'
),
);
$yourArray = array();
$array = array();
foreach ($array1 as &$array){
$yourArray[] = array_map('strtolower', $array);
}
echo "<pre>"; print_r($yourArray);
$array2 = array(
'email' => 'example1223@sample.com',
'status' => 'Pending'
);
$yourArray2 = array_map('strtolower', $array2);
if(in_array($yourArray2 , $yourArray)) {
echo "match";
} else {
echo "no match";
}
echo "<pre>"; print_r($yourArray2);