On 10/1/2009 5:28 AM, Dave Maharaj :: WidePixels.com wrote:
> My bad....
>
> The array is more complex than I originally posted.
>
> So I need Program and Skill sorted alphabetically
>
> Array
> (
>
>      [Program] =>  Array
>          (
>              [0] =>  After School Studies
>              [1] =>  Gym
>              [2] =>  Creative Writing
>          )
>
>      [Skill] =>  Array
>          (
>               [0] =>  Cohghol
>               [1] =>  Shit
>               [2] =>  Thfghfdgh
>               [3] =>  Zoo
>               [4] =>  Alfred
>               [5] =>  Michelle
>          )
>
>
>
> )
>
> How can I do this?
>
> Program and Skill are merged arrays. I tried sorting them after the merge
> but same thing... Still produced 1
>
> $sorted = array_merge ($new_data, $selected);
> //$area is the array value Program or Skill in this case so it inserts the
> data into Program or Skill
> $new_selections = Set::insert($all_selections, $area, $sorted);
>
>
>    
$program = array('After School Studies', 'Gym', 'Creative Writing');
$skill = array('Cohghol', 'Shit', 'Thfghfdgh', 'Zoo', 'Alfred', 'Michelle');

$merged = array_merge($program, $skill);

natsort($merged);

var_dump($merged);

Sort functions return boolean. In your case:
$sorted = sort($merged);

After this line $sorted will be boolean and $merged will be sorted.

php.net/sort
php.net/natsort

HTH


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to