note 100783 added to function.array-multisort
| From: | marcelatnxserver dot de at osu1 dot php dot net | Date: | Sat, 06 Nov 2010 00:01:56 +0000 |
| Subject: | note 100783 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173806@lists.php.net to get a copy of this message | ||
there is a bug in your function.
i have marked the line...
it has to be as followed:
<?php
function array_orderby()
{
$args = func_get_args();
$data = array_shift($args);
foreach ($args as $n => $field) {
if (is_string($field)) {
$tmp = array();
foreach ($data as $key => $row)
$tmp[$key] = $row[$field];
-----> $args[$n] = &$tmp;
}
}
$args[] = &$data;
call_user_func_array('array_multisort', $args);
return array_pop($args);
}
?>
----
Server IP: 212.124.37.9
Probable Submitter: 89.166.200.137
----
Manual Page -- http://www.php.net/manual/en/function.array-multisort.php
Edit -- https://master.php.net/note/edit/100783
Del: integrated -- https://master.php.net/note/delete/100783/integrated
Del: useless -- https://master.php.net/note/delete/100783/useless
Del: bad code -- https://master.php.net/note/delete/100783/bad+code
Del: spam -- https://master.php.net/note/delete/100783/spam
Del: non-english -- https://master.php.net/note/delete/100783/non-english
Del: in docs -- https://master.php.net/note/delete/100783/in+docs
Del: other reasons-- https://master.php.net/note/delete/100783
Reject -- https://master.php.net/note/reject/100783
Search -- https://master.php.net/manage/user-notes.php