Can anyone please help me how to parse this PHP array as It gives error in foreach loop and even It’s not working to get values using index.
$PatientTestArray = Array
(
[0] => Array
(
[tube_number] => 230389414
[test_group] => Fasting blood Sugar
)
[1] => Array
(
[tube_number] => 230389418
[test_group] => HbA1c
)
[2] => Array
(
[tube_number] => 230388418
[test_group] => HbA1c
)
)
print_r($PatientTestArray); //This works it print all the array
//This below code returns Null , it returns empty string.
foreach ($PatientTestArray as $key => $value) {
echo $value;
print_r($value);
}
The above array is fetched from mysql database and it looks like a string to me, I changed it’s type to array to parse it and also I tried different many solutions, can anyone know how can I parse below array.
I tried different solutions but nothing helps me to fix this.