Hi I've created an array with a for loop inside. The array doesn't have any data inside it until it reaches the for loop. I wanted to add an associative array to what I've done so far. For example my array currently ouputs
[0] => Array
(
[0] => Version 5
[1] => Feb-16
[2] => gary
[3] => 80
[4] => P
)
I would like it to have headings instead of numbers
[0] => Array
(
Version => Version 5
Date => Feb-16
Name => gary
RandNum => 80
Letter => P
}
I'm not sure how i'd fit into my loop and how I could if my different columns these headings. Below is my current code. Which outputs the array at the top.
for($i = 0; $i <= 3; $i++){
for($j = 0; $j <= 4; $j++){
if ($j == 0){
$times_table[$i][$j]= "Version 5" ;
}
else if ($j == 1){
$cur_date = date("M-y", $currentdate);
$currentdate = strtotime('+1 month', $currentdate);
$times_table[$i][$j]= "<strong>" . $cur_date . "</strong>" ;
}
else{
$times_table[$i][$j]= "gary" ;
}
if ($j == 3) {
$numbers = mt_rand(1, 100);
$times_table[$i][$j]= $numbers ;
}
if ($j == 4){
if($i == 0 || $i == 3)
{
$pay = "P";
$times_table[$i][$j]= $pay ;
}
else{
$int = "I";
$times_table[$i][$j]= $int ;
}
}
}
}