|
Posted by comp.lang.php on 09/11/06 14:40
[PHP]
array_walk($result, create_function('$a, $b', 'return
(strtolower($a->{$section . "_name"}) < strtolower($b->{$section .
"_name"}));'), $section);
[/PHP]
I thought this would sort an object array by the property {$section .
"_name"} (the variable $section has multiple values, hence, the object
array might be "image_name", "video_name", "audio_name",
"anything_name", but it will definitely exist, by whatever name
comprises ${section}_name, in the object property within the object
that makes up each array element), however, the sorting never takes
place.
How can I ensure that the object array is always sorted by
$obj->{$section . "_name"}?
Thanx
Phil
Navigation:
[Reply to this message]
|