note 105115 added to function.array-multisort

From: Date: Thu, 28 Jul 2011 15:59:07 +0000
Subject: note 105115 added to function.array-multisort
Groups: php.notes 
Request: Send a blank email to php-notes+get-181958@lists.php.net to get a copy of this message
since my old entry got deleted, because it was too long, and since i got so much feedback, i'll post the array_csort again. if you want to sort an array by columns, this is the function to do it. explanation & example (was too long...) now here: http://www.ichier.de/coding/array_csort.html <?php function array_csort() { //coded by Ichier2003 $args = func_get_args(); $marray = array_shift($args); $msortline = 'return(array_multisort('; foreach ($args as $arg) { $i++; if (is_string($arg)) { foreach ($marray as $row) { $sortarr[$i][] = $row[$arg]; } } else { $sortarr[$i] = $arg; } $msortline .= '$sortarr['.$i.'],'; } $msortline .= '$marray));'; eval($msortline); return $marray; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 88.74.17.255 ---- Manual Page -- http://www.php.net/manual/en/function.array-multisort.php Edit -- https://master.php.net/note/edit/105115 Del: integrated -- https://master.php.net/note/delete/105115/integrated Del: useless -- https://master.php.net/note/delete/105115/useless Del: bad code -- https://master.php.net/note/delete/105115/bad+code Del: spam -- https://master.php.net/note/delete/105115/spam Del: non-english -- https://master.php.net/note/delete/105115/non-english Del: in docs -- https://master.php.net/note/delete/105115/in+docs Del: other reasons-- https://master.php.net/note/delete/105115 Reject -- https://master.php.net/note/reject/105115 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181958) next »