You can take reference form below example to fetch data from array list using php.
This method is really very easy.
<?php
// you have to Decode the array and store a variable
$GetRecord = json_decode('[{"Name":"Mac","age":"25"},{"Name":"Warner","age":"30"},{"Name":"Cris","age":"22"},{"Name":"Broad", "age":"40"},{"Name":"Joe","age":""}]');
// Loop for find the array value
foreach ($GetRecord as $key => $value) {
if ($value->Name == Mac && ($value->age == 25 ))
{
echo 'success-! Record found ';
exit;
}else{
echo ' Error-! Record not found';
exit;
}
}
?>
If name and age exist in given array list then result will come "success-! Record found".
If name and age not exist in given array list then result will come "Error-! Record not found".
0 Comment(s)