Geting this value to the beginning of an array....
Posted: Wed Dec 22, 2004 4:32 pm
I have an array like this:
Array
(
[Rocky Mountain] => Rocky Mountain
[Northeastern] => Northeastern
[Southeastern] => Southeastern
[Midwestern] => Midwestern
[Northwestern] => Northwestern
[Southwestern/Gulf States] => Southwestern
[Western] => Western
[Camp Information] => Camp Information // I'd like this element to be at the top of the list...
)
I'd like the Camp Information key to be at the top of the list and I'm not sure how to do it....
Below is how the 'camp information' is being added to the array...
I've tried array_unshift. But the val outputs as 'array'...
I'm not sure how to do this?
Any ideas?
Thanks
Array
(
[Rocky Mountain] => Rocky Mountain
[Northeastern] => Northeastern
[Southeastern] => Southeastern
[Midwestern] => Midwestern
[Northwestern] => Northwestern
[Southwestern/Gulf States] => Southwestern
[Western] => Western
[Camp Information] => Camp Information // I'd like this element to be at the top of the list...
)
I'd like the Camp Information key to be at the top of the list and I'm not sure how to do it....
Below is how the 'camp information' is being added to the array...
Code: Select all
<?php
foreach ($temp['selected'] as $key => $val )
{
$temp['option'][$key] = $val; //$temp['option'] is already an array
}
?>I'm not sure how to do this?
Any ideas?
Thanks