I have this multidimensional array:
Array
(
[userId] => 35
[fieldId] => Array
(
[0] => 1
[1] => 2
[2] => 3
[4] => 4
)
[educationTitle] => Array
(
[0] => School1
[1] => School2
[2] => 3
[4] =>
)
[educationDegree] => Array
(
[0] => Degree1
[1] => Degree2
[2] => 3
[4] =>
)
[startDate] => Array
(
[0] => 2013-03-01
[1] => 2013-03-03
[2] => 1970-01-01
)
[endDate] => Array
(
[0] => 2013-03-02
[1] => 2013-03-04
[2] => 1970-01-01
)
[educationDescription] => Array
(
[0] => Description1
[1] => Description2
[2] =>
)
)
And I have an array of ids called matches
:
[matches] => Array
(
[0] => 1
[1] => 2
)
I need to split the main array into two:
$eduAdd = array()
$eduUpdate = array()
$eduAdd
will contain the non-matching fieldId's and $eduUpdate
will contain the matching fieldId's.
$eduAdd
Would look like this:
Array
(
[userId] => 35
[fieldId] => Array
(
[2] => 3
[4] => 4
)
[educationTitle] => Array
(
[2] => 3
[4] =>
)
[educationDegree] => Array
(
[2] => 3
[4] =>
)
[startDate] => Array
(
[2] => 1970-01-01
)
[endDate] => Array
(
[2] => 1970-01-01
)
[educationDescription] => Array
(
[2] =>
)
)
I tried this, but found out in_array
does not work on multidimensional arrays:
foreach($filteredSubmittedData as $filteredUpdates){
if(in_array($filteredUpdates['fieldId'], $matches)){
echo "yup";
}
}
How can I do this?