Hi All,
I have an array that contains a list of 10 files. I want to change the order of some of the elements in the array so whe I do a for each loop the first three elements are always in the same order.
eg:
Alternatively is there someway to manipulate the key?
I have an array that contains a list of 10 files. I want to change the order of some of the elements in the array so whe I do a for each loop the first three elements are always in the same order.
eg:
Code:
$contentfiles = glob("" . $files . "*.php");
$correctorder = array ('0' => "./index.php", '1' => "./services.php", '2' => "./map.php", '3' => "", '4' => "", '5' => "", '6' => "", '7' => "", '8' => "", '9' => "", '10' => "");
Alternatively is there someway to manipulate the key?
Code:
$contentfiles = glob("" . $files . "*.php");
//not actual code but what I'm trying to explain :-)
$correctorder = array ('2','4','5','0','1','3');
$contentfiles[$key]=$correctorder[key];
foreach ($contentfiles as $filename){
blah
}