Hi i've created an array with 4 rows and 5 columns. I now want to sort the array by the random number in my array but not how to sort multidimensional arrays. I seen online that I may have use a for each loop but not sure where to place it if I were to use one. Also I'm not sure how I to tell the sortarray what column I want to sort as I don't have any id for the outputs. Any help would be myuch appreciated.
<?php
$vyear = 1;
$vmonth= 3;
$date = "2015-11-25";
$t = 0;
echo date("M-y") . "<br>";
$startdate = "2009/06/01";
$start = strtotime($date);
$currentdate = $start;
$newdate = strtotime ( $t .'month' , strtotime ( $date ) ) ;
$ndate = date ( 'm-Y-d' , $newdate );
echo $ndate;
echo "<br>";
echo "<br>";
echo $date;
$times_table = array();
for($i = 0; $i <= 3; $i++){
$times_table[$i] = array();
}
echo "<pre>";
for($i = 0; $i <= 3; $i++){
for($j = 0; $j <= 4; $j++){
if ($j == 0){
$times_table[$i][$j]= "Version 4" ;
}
else if ($j == 1){
$cur_date = date("M-y", $currentdate);
$currentdate = strtotime('+1 month', $currentdate);
$times_table[$i][$j]= $cur_date ;
echo $cur_date . ">". "<br />";
}
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 ;
}
}
}
}
// echo $times_table[1][3] ;
print_r($times_table);
echo "</pre>";
?>