I have two arrays. I am looping first array and checking if value exist in second array and deleting that element from second array.
Here is my code.
$options = array();
"OptionValues": [
{
"OptionId": "22",
"OptionName": "Gener"
},
{
"OptionId": "21",
"OptionName" : "Gener"
}
foreach($OptionValues as $optValue){
$optionIdVal = $optValue['OptionId'];
foreach ($options as $option) {
if($option['value'] == $optionIdVal){
unset($option['value']);
}
}
}
This is working only for first time and skipping next element check. Please anyone help me. Thanks
Aucun commentaire:
Enregistrer un commentaire