santa
04-29-2008, 09:20 AM
I need help with making this work.
I have two arrays. I need to compare the two and create third array that has values in the 1st array but does not have the values in the second.
Sounds pretty easy and array_diff comes to mind, but I'm getting confused because my second array is an array withing array sort of. Need help with debugging.
$firstArray = array('a', 'b', 'c', 'd', 'e', 'f');
$secondArray = // my values
print_r($secondArray);
//WILL RETURN
//Array ( [0] => Array ( [name] => a [size] => 12345) [1] => Array ( [name] => c [size] => 15447) [2] => Array ( [name] => e [size] => 15447))
I need to be able to do the following:
$thirdArray = array_diff($firstArray, $secondArray);
Stuck... Need help. Thanks.
I have two arrays. I need to compare the two and create third array that has values in the 1st array but does not have the values in the second.
Sounds pretty easy and array_diff comes to mind, but I'm getting confused because my second array is an array withing array sort of. Need help with debugging.
$firstArray = array('a', 'b', 'c', 'd', 'e', 'f');
$secondArray = // my values
print_r($secondArray);
//WILL RETURN
//Array ( [0] => Array ( [name] => a [size] => 12345) [1] => Array ( [name] => c [size] => 15447) [2] => Array ( [name] => e [size] => 15447))
I need to be able to do the following:
$thirdArray = array_diff($firstArray, $secondArray);
Stuck... Need help. Thanks.