I am trying to match two strings using foreach loop in php ( laravel framework).
$c_act = "ABC123";
foreach ($codes as $cd) {
$ac = $cd->Code; //ac holds our Activity code
if ($ac==$c_act) {
$act_id = $cd->ID;
}
}
here $codes holds data from my values with ID and Code.Its
[{"ID":"7","Code":"ABC-1"},{"ID":"8","Code":"ABC-OBT"},{"ID":"12","Code":"ABCD"}]
If the first variable is not a match, then I need to go back to foreach loop and start with the next value I have. I tried, But couldn't complete it.
How to do this using php?
Thanks in advance