RE: Sort 2 arrays into 1

2009-12-27 Thread Dave
Thanks for your response.

I ended up going with:

Set::sort($selections, '{n}.Skill.name', 'asc');


Dave

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of peterchenadded
Sent: December-28-09 12:00 AM
To: CakePHP
Subject: Re: Sort 2 arrays into 1

See code below...

 array(
'Skill' => array(
  'name' => 'Peter'
)
  ),
  1 => array(
'Skill' => array(
  'name' => 'Alla'
)
  ),
  2 => array(
'Skill' => array(
  'name' => 'Wu'
)
  )
);

print_r($a);

usort($a, 'cmp');
echo '';

print_r($a);
?>

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com To
unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group 
cake-php+at http://groups.google.com/group/cake-php?hl=en
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.722 / Virus Database: 270.14.114/2575 - Release Date: 12/27/09
05:48:00

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Sort 2 arrays into 1

2009-12-27 Thread peterchenadded
See code below...

 array(
'Skill' => array(
  'name' => 'Peter'
)
  ),
  1 => array(
'Skill' => array(
  'name' => 'Alla'
)
  ),
  2 => array(
'Skill' => array(
  'name' => 'Wu'
)
  )
);

print_r($a);

usort($a, 'cmp');
echo '';

print_r($a);
?>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Sort 2 arrays into 1

2009-12-27 Thread Dave
I have 2 queries that I merge into 1. so below key [0] was a user entered
entry and [1] and [2] were selected from a list of options, so if there is a
skill the user has that is not in the available list they can add their own
which is where key [0] came from.

How can I now sort this array so its alphabetical based on the
[Skill][name]?
 
Array
(
[0] => Array
(
[id] => 25
[Skill] => Array
(
[name] => User entered value
)

[Year] => Array
(
[range] => 0 - 6 Months
)

)

[1] => Array
(
[id] => 68
[Skill] => Array
(
[id] => 13
[skillset_id] => 1
[name] => English
)

[Year] => Array
(
[id] => 3
[range] => 1 - 3 Years
)

)

[2] => Array
(
[id] => 69
[Skill] => Array
(
[id] => 47
[skillset_id] => 5
[name] => Math)

[Year] => Array
(
[id] => 5
[range] => 5 - 10 Years
)

)


Thanks,

Dave
 

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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