I have been trying to create a mutliple dimensional array and fill the values with a value, number 7 in the example. However, I have been unable to access this value when trying to print.
code:
<?php
$resources = 3;
$units = 3;
for($x=1; $x<$resources+1; $x++)
{
for($y=1; $y<$units+1; $y++)
{
$resource['$x']['$y'] = 7;
print("Resource[$x][$y] = $resource[$x][$y]<br>");
}
}
?>
output:
Resource[1][1] = [1]
Resource[1][2] = [2]
Resource[1][3] = [3]
Resource[2][1] = [1]
Resource[2][2] = [2]
Resource[2][3] = [3]
Resource[3][1] = [1]
Resource[3][2] = [2]
Resource[3][3] = [3]
What have I missed to have 7 print for all the variables?