I am still very new to PHP and from all the examples that are around they all seem to use foreach statements.
e.g.
foreach ($variable as $row)
However I don't think I should be using this all the time, for example variables or objects I have an which only has one row or instance in an array.
I know its advantageous to use them for multiple rows which could be missed if you used a for loop.
But do I really need to use it just to echo one variable thats in an array?
e.g. for example this variable $stats
array(3) {
["user_interventions"] => int(4)
["fastest_intervention"] => array(1) {
[0] => object(stdClass)#22 (1) {
["duration"] => string(8) "02:10:00"
}
}
["slowest_intervention"] => array(1) {
[0] => object(stdClass)#23 (1) {
["duration"] => string(8) "02:26:00"
}
}
}
echo $array['keyname'],echo $object->propertynameand such.