I've got the following snippet to dump some info on the screen:
for ($i=0; $i < 60; $i++) {
echo 'output: '.$array[$i]['options'][0]."<br />";
echo 'output: '.$array[$i]['options'][4]."<br />";
}
which outputs the following:
output: Lorem ipsum
output: 1
output: dolor sit amet
output: 1
output: consectetur adipiscing elit
output: 0
How do I wrap the echo statements in a conditional, so only when ['options'][4] == '1'
it will run?
if ($array[$i]['options'][4] == '1') {
...
}
Doesn't work and returns nothing, set it to == '0'
and you'll get everything.
I've tried assigning it to a variable first, tried converting to ints first, but they all seem to return 0, while an echo displays the value.
Got night-time creative with foreach loops
, trying to drill down to the items, only resulting in loss of keys where values were still properly read. Its probably something simple, but its been ages since I dabbled with php and arrays.