note 99795 added to function.sort

From: Date: Tue, 07 Sep 2010 11:42:07 +0000
Subject: note 99795 added to function.sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-172356@lists.php.net to get a copy of this message
<?php function sort_by($array,$field,$desc='desc'){ $index = array(); $result = array(); foreach($array as $k=>$row){ $index[] = $row[$field];} if ('desc' == $desc){ arsort($index); } else { asort($index);} foreach($index as $k=>$value){ $result[] = $array[$k]; unset($array[$k]); } return $result; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 109.71.42.6 ---- Manual Page -- http://www.php.net/manual/en/function.sort.php Edit -- https://master.php.net/note/edit/99795 Del: integrated -- https://master.php.net/note/delete/99795/integrated Del: useless -- https://master.php.net/note/delete/99795/useless Del: bad code -- https://master.php.net/note/delete/99795/bad+code Del: spam -- https://master.php.net/note/delete/99795/spam Del: non-english -- https://master.php.net/note/delete/99795/non-english Del: in docs -- https://master.php.net/note/delete/99795/in+docs Del: other reasons-- https://master.php.net/note/delete/99795 Reject -- https://master.php.net/note/reject/99795 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172356) next »