How to print an entire array when one index is constant.
For understanding purposes I have made this array
$actionF = array(
"enemyHlth" => array(array()),
"enemyBlts" => array(array())
);
with input
3 2 1
1 2 3
3 2 1
1 2 3
3 2 1
1 2 3
The array structure is supposed to store top three rows under a 3D array with 3rd dimension is just a constant "Enemy Health" while the bottom three in 3D array with same for 3rd dimension "Enemy Bullets". And both these two 3D arrays are stored in a single array called ActionF
Now when I try to print it
for($level=0;$level<$n;$level++){
$actionF["enemyHlth"] = array ( $level => fscanf($_fp,"%d\t%d\t%d\n")
);
}
for($bullets = 0;$bullets<$m; $bullets++){
$actionF["enemyBlts"] = array ( $bullets => fscanf($_fp,"%d\t%d\t%d\n")
);
}
print_r($actionF);
Output
3 2 1
I think it is printing the last index of above I/P. How to make a 2D array when third dimension is just a constant or is there something else am I missing?