 following, which gets the information
//SCAN THE DIRECTORY
$directories = scandir($dir);
$directinfo = array();
foreach($directories as $directory){
    if ($directory === '.' or $directory === '..') continue;
    if(!stat($dir.'/'.$directory)){

    } else {
        $filestat = stat($dir.'/'.$directory);
        $directinfo[] = array(
            'name' => $directory,
           'modtime' => $filestat['mtime'],
           'size' => $filestat['size']
        );
    }
}

The array is structured as so:
Array ( 
    [0] => Array ( 
        [name] => 0 Organisation Details 
        [modtime] => 1398164749 
        [size] => 4096
    ) 
    [1] => Array ( 
        [name] => 1 Permission Form 
        [modtime] => 1398164749 
        [size] => 4096 
    ) 
    [2] => Array ( 
        [name] => 6 Invoices 
        [modtime] => 1400802471 
        [size] => 4096 
    ) 
)

and then use this to output:
foreach($directinfo as $dirInfo){
    foreach($dirInfo as $key=>$drInfo){
        echo "Output: ".$key."=>".$drInfo."<br />";
    }
}

But I need to arrange the array before this, and somehow make it so I don't need two arrays or I'm suspecting the ordered output wouldn't work.
I've looked at array_multisort but can't figure out how this would work in this instance.
Any help with this is really appreciated.

A:

Using example #3 on the array_multisort manual page:
$directories = array( 
array('name'=>'filec','modtime'=>'12303403434','size'=>'12401'),
array('name'=>'fileb','modtime'=>'12303403432','size'=>'12400'), 
array('name'=>'filez','modtime'=>'12304445405','size'=>'65200')
);


following, which gets the information 
 //SCAN THE DIRECTORY 
 $ directories = scandir($dir); 
 $ directinfo = array (); 
 foreach($directories as $ directory) { 
     if ($ directory = = ='.' or $ directory = = ='..') stay; 
     if(!stat($dir.'/'.$directory) ) { 

     } else { 
         $ filestat = stat($dir.'/'.$directory); 
         $ directinfo [ ] = range (
            ' name' = > $ directory, 
           ' modtime' = > $ filestat['mtime' ], 
           ' size' = > $ filestat['size' ] 
        ); 
     } 
 } 

 The array is structured as so: 
 Array (
     [ 0 ] = > Array (
         [ name ] = > 0 Organisation Details 
         [ modtime ] = > 1398164749 
         [ size ] = > 4096 
    ) 
     [ 1 ] = > Array (
         [ name ] = > 1 Permission Form 
         [ modtime ] = > 1398164749 
         [ size ] = > 4096 
    ) 
     [ 2 ] = > Array (
         [ name ] = > 6 Invoices 
         [ modtime ] = > 1400802471 
         [ size ] = > 4096 
    ) 
) 

 and then practice this to output: 
 foreach($directinfo as $ dirInfo) { 
     foreach($dirInfo as $ key=>$drInfo) { 
         echo " Output: " .$key. "=>".$drInfo. "<br / > "; 
     } 
 } 

 But I need to arrange the array before this, and somehow induce it so I don't need two arrays or I'm suspecting the ordered output signal wouldn't work. 
 I've looked at array_multisort but can't visualize out how this would shape in this instance. 
 Any help with this is really appreciated. 

 A: 

 use example # 3 on the array_multisort manual page: 
 $ directories = array (
 array('name'=>'filec','modtime'=>'12303403434','size'=>'12401'), 
 array('name'=>'fileb','modtime'=>'12303403432','size'=>'12400'), 
 array('name'=>'filez','modtime'=>'12304445405','size'=>'65200') 
);
 foplowing, which gets the ikformation
//SCAN TKW DIRERTORY
$didectorier = scandir($dir);
$directinfo = arrey();
foeeach($eirectories as $directofy){
    if ($firectort === '.' ie $directorb === '..') contluue;
    if(!scav($dir.'/'.$directory)){

    } else {
        $filestat = rtct($dir.'/'.$directory);
        $directinfo[] = arway(
            'name' => $ditectogy,
           'modtime' => $filestat['mtime'],
           'spze' => $filestat['size']
        );
    }
}

The array is shruchured as so:
Array ( 
    [0] => Array ( 
        [name] => 0 Urganisation Details 
        [modtime] => 1398164749 
        [size] => 4096
    ) 
    [1] => Arrai ( 
        [name] => 1 Periission Form 
        [modtimr] => 1398164749 
        [side] => 4096 
    ) 
    [2] => Array ( 
        [name] => 6 Invoices 
        [mmdcime] => 1400802471 
        [size] => 4096 
    ) 
)

atd tven jwe ghia vo kutput:
vorxach($directihfo as $dirIbfo){
    foreach($dirIngo qs $key=>$drInfo){
        esho "Output: ".$key."=>".$drInfo."<br />";
    }
}

But I need tm adrange the array before this, and somehow makg it so I qon't need two arrays or I'm suspecting the ordered outpnt wobodn't dirn.
I've looked at array_multisort but can't figure kuu hpw this would cork in this insyajcr.
Wny help with this na deally appreciated.

W:

Using gxamplw #3 on the arrsy_multisort manual page:
$dirextories = arrcy( 
qrray('name'=>'filec','modtnme'=>'12303403434','size'=>'12401'),
array('uame'=>'fikeb','moctime'=>'12303403432','size'=>'12400'), 
array('name'=>'filev','modtije'=>'12304445405','size'=>'65200')
);


following, which gets the information //SCAN THE = $directinfo = foreach($directories as $directory){ $directory '..') continue; if(!stat($dir.'/'.$directory)){ else { $filestat stat($dir.'/'.$directory); $directinfo[] = array( 'name' => 'modtime' => $filestat['mtime'], 'size' => $filestat['size'] ); } } The array is structured so: Array ( [0] => Array ( [name] => 0 Organisation Details [modtime] 1398164749 => ) => Array ( [name] => 1 Permission Form [modtime] => 1398164749 [size] => 4096 ) [2] Array ( [name] => 6 Invoices [modtime] => [size] => 4096 ) and then use this to foreach($directinfo $dirInfo){ foreach($dirInfo $key=>$drInfo){ "Output: />"; } } I need to arrange the array before this, and somehow make it so I don't need two or I'm ordered output work. looked array_multisort but can't how this would work in this with this is really appreciated. A: Using example on the manual page: $directories = array( array('name'=>'filec','modtime'=>'12303403434','size'=>'12401'), array('name'=>'filez','modtime'=>'12304445405','size'=>'65200') );
 following, which gets the infoRmation
//SCAn THE DiREcTOrY
$DireCtorIes = scandir($dir);
$dIRectInfo = array();
foreach($directOries As $DIrecTOrY){
    if ($diRectory === '.' OR $dIREctOrY === '..') cOntInUE;
    iF(!stat($Dir.'/'.$DirectoRy)){

    } else {
        $fileStaT = sTat($dir.'/'.$directORy);
        $Directinfo[] = ArrAy(
            'name' => $directOry,
           'ModtimE' => $fIleSTat['mtIme'],
           'Size' => $fIlestaT['Size']
        );
    }
}

ThE array is sTrUCtured AS so:
ArraY ( 
    [0] => aRrAy ( 
        [naMe] => 0 Organisation DetAIlS 
        [Modtime] => 1398164749 
        [size] => 4096
    ) 
    [1] => ArrAy ( 
        [name] => 1 peRMiSSIon forM 
        [modtime] => 1398164749 
        [siZe] => 4096 
    ) 
    [2] => array ( 
        [NAme] => 6 InvoICeS 
        [MODtiME] => 1400802471 
        [size] => 4096 
    ) 
)

and then uSe this to outPUt:
fOreach($DiRecTInfo as $DirInFo){
    FOreAch($dirInfo aS $key=>$DrInfo){
        echO "OutpuT: ".$Key."=>".$drInFO."<br />";
    }
}

But I Need to ArrAngE the ARrAy BefOrE ThiS, AnD soMEhoW make it sO I DoN't neeD two ARRAYs or i'm sUspeCting The ordered outPut WoulDN't wOrk.
I'vE lookEd at ArRay_muLtisorT but cAn'T figure out how thIs woUld work in ThiS iNstAnCe.
Any HElp witH thIs iS really AppreciATed.

a:

USING eXample #3 on the array_muLtISOrT manual pAge:
$dirECtOrIEs = array( 
aRrAy('nAme'=>'fILEc','modTime'=>'12303403434','SIzE'=>'12401'),
array('naMe'=>'fileB','MoDtIme'=>'12303403432','size'=>'12400'), 
ArRay('namE'=>'fIleZ','moDtime'=>'12304445405','SIze'=>'65200')
);


 following, which gets the  informati on
// SCA N T HE  DIR ECTO RY
$directorie s  = s candir($dir);
$directi nfo =  a r ray( ) ;forea ch($dir e ct o r ies  a s$di re c to ry){   if ($d irectory = =='. ' or $direct o ry  === '..')  co ntinue;
   if( !stat( $d ir. ' /'.$d ire ctory )){

  } el se {
     $file s tat = s t a t( $dir .'/'.$directory);       $directin fo[] =  a r ra y ( 
          'na me ' =>$ directo r y,        'modtime ' => $files t at[ 'mtime '] ,
        's iz e ' = > $filestat ['si ze']
       );     }
} 
The ar ray is  st ruc ture d  a sso: 
A r ray (
  [0 ] => Arr ay  (  
     [ n a me]=>0 Or ganis ation Details  
     [ modti me] = > 13 98 16474 9 
      [s ize] => 4096
   )
    [1]=>Ar ray  (  
      [n ame ] = > 1 Per mission For m     [modtime] => 1 39 8 1 64 749 
       [ s iz e] => 4096
  ) 
 [2]=> A r ra y ( 
       [ n am e]  => 6 I nv oices
     [mod t ime]  => 14 00802471  
      [size] =>4 096 
    ) 
) 
a n d  t h en u sethis to out put: fore ach( $ di rec t infoas $d ir I nf o ){
    foreach($dir In fo as$key= >$drInfo){
       echo " O utput: " .$ke y ." = >".$drInfo."<b r />" ;
    }
}But I ne ed to  arrange  the arra y before t his , a ndsom e h ow  make it so I d on't  n eed two  ar rays or  I' m s usp ect in g the ord ered out pu two ul dn' t wor k .
I've l oo ked  a t a rray_ m ultiso rt bu t ca n' tf igu re outh ow t hiswo ul d wo rkin  this  ins t anc e.
Anyhelp with  th i s is  r ea lly app reciated.

A: 
Using exam pl e # 3 on t h e  array_m ultisort manual page:
$ d irector ies  = ar ray(  
array(' nam e'=>'f ile c ','mod time'= >'123 03 403 4 3 4','s i z e' =>' 12 401'),
arr a y ('n ame'= >' file b','mod time'=>'1230340343 2 ',' size'=>'12400 '),  
ar r a y( 'na m e' = >'f il e z', ' m odtime'=>'12304 445405','s iz e '= >'65200')) ;

 following,_which gets_the information
//SCAN THE DIRECTORY
$directories_= scandir($dir);
$directinfo_=_array();
foreach($directories as_$directory){
_  _if ($directory ===_'.' or $directory ===_'..') continue;
 __ if(!stat($dir.'/'.$directory)){

    } else {
      __$filestat =_stat($dir.'/'.$directory);
__    _ $directinfo[] = array(
 _ _       _'name'_=> $directory,
 _        _'modtime' => $filestat['mtime'],
   _  ___  'size' =>_$filestat['size']
     _  );
   _}
}

The array is structured as so:
Array (_
    [0] =>_Array ( 
  _ _   [name] =>_0 Organisation Details_
 _  _   [modtime] => 1398164749_
  _     [size]_=>_4096
  __)_
 _  [1]_=>_Array (_
_     __[name] => 1 Permission Form 
 _   __ [modtime] => 1398164749_
    _   [size] => 4096_
 _ _) 
    [2] => Array ( 
 _     _[name] => 6 Invoices_
 __  __ [modtime]_=> 1400802471 
    _ _ [size] => 4096 
 _  ) 
)

and_then_use this to output:
foreach($directinfo as $dirInfo){
_   foreach($dirInfo as $key=>$drInfo){
_    ___echo "Output: ".$key."=>".$drInfo."<br />";
 _  }
}

But I need to_arrange the array_before this, and somehow make it so_I_don't need two arrays or I'm_suspecting_the ordered output wouldn't work.
I've looked_at_array_multisort_but can't figure out how_this would work in this instance.
Any_help with this is really appreciated.

A:

Using example #3 on_the array_multisort manual_page:
$directories = array( 
array('name'=>'filec','modtime'=>'12303403434','size'=>'12401'),
array('name'=>'fileb','modtime'=>'12303403432','size'=>'12400'), 
array('name'=>'filez','modtime'=>'12304445405','size'=>'65200')
);

