note 78943 added to function.array-multisort
| From: | zzo38 at osu1 dot php dot net | Date: | Sat, 03 Nov 2007 18:43:58 +0000 |
| Subject: | note 78943 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131969@lists.php.net to get a copy of this message | ||
It doesn't work correctly with references. I fixed it by removing the & sign before $track
and adding return $track to the end, and then it works OK.
<?php
function event_sort(&$track) {
$track=array_values($track);
$types=array('off'=>'a','meta'=>'b','prog'=>'c',
'control'=>'d',
'on'=>'e','touch'=>'f','bend'=>'g',
'ctouch'=>'h','sysex'=>'i','end'=>'j');
$hashes=array();
foreach($track as $k=>$v) $hashes[$k] =
($v['type']=='end'?'z':'a') . strrev($v['time'])
. $types[$v['type']];
array_multisort($hashes,$track);
}
?>
----
Server IP: 216.235.15.211
Probable Submitter: 24.207.61.48
----
Manual Page -- http://www.php.net/manual/en/function.array-multisort.php
Edit -- https://master.php.net/note/edit/78943
Del: integrated -- https://master.php.net/note/delete/78943/integrated
Del: useless -- https://master.php.net/note/delete/78943/useless
Del: bad code -- https://master.php.net/note/delete/78943/bad+code
Del: spam -- https://master.php.net/note/delete/78943/spam
Del: non-english -- https://master.php.net/note/delete/78943/non-english
Del: in docs -- https://master.php.net/note/delete/78943/in+docs
Del: other reasons-- https://master.php.net/note/delete/78943
Reject -- https://master.php.net/note/reject/78943
Search -- https://master.php.net/manage/user-notes.php