note 80802 added to function.asort

From: Date: Thu, 31 Jan 2008 23:56:00 +0000
Subject: note 80802 added to function.asort
Groups: php.notes 
Request: Send a blank email to php-notes+get-135686@lists.php.net to get a copy of this message
Small typo in the aksort function I just submitted. Here's the entire thing again, with the correction noted: <?php function aksort(&$array,$valrev=false,$keyrev=false) { if ($valrev) { arsort($array); } else { asort($array); } $vals = array_count_values($array); $i = 0; foreach ($vals AS $val=>$num) { $first = array_splice($array,0,$i); $tmp = array_splice($array,0,$num); if ($keyrev) { krsort($tmp); } else { ksort($tmp); } $array = array_merge($first,$tmp,$array); unset($tmp); $i = $i+$num; // Fixed from previous post: $i = $num; } } ?> ---- Server IP: 208.69.120.35 Probable Submitter: 66.239.31.243 ---- Manual Page -- http://www.php.net/manual/en/function.asort.php Edit -- https://master.php.net/note/edit/80802 Del: integrated -- https://master.php.net/note/delete/80802/integrated Del: useless -- https://master.php.net/note/delete/80802/useless Del: bad code -- https://master.php.net/note/delete/80802/bad+code Del: spam -- https://master.php.net/note/delete/80802/spam Del: non-english -- https://master.php.net/note/delete/80802/non-english Del: in docs -- https://master.php.net/note/delete/80802/in+docs Del: other reasons-- https://master.php.net/note/delete/80802 Reject -- https://master.php.net/note/reject/80802 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135686) next »