note 71492 added to function.array-multisort

From: Date: Fri, 01 Dec 2006 14:58:21 +0000
Subject: note 71492 added to function.array-multisort
Groups: php.notes 
Request: Send a blank email to php-notes+get-120219@lists.php.net to get a copy of this message
casting the parameter arrays for array_multisort seem to make the sorting ineffective? for example:- <? foreach((array)$report_files as $report_files_i) { $file_stat = stat($report_files_i); $report_files_x[] = array( 'filename' => $report_files_i ,'basename' => basename($report_files_i) ,'ctime' => date("D, M j, Y",$file_stat['ctime']) ,'size' => $file_stat['size'] ); $basename_i[] = strtolower(basename($report_files_i)); // case insensitive } array_multisort($basename_i, SORT_ASC, $report_files_x); ?> The above works but if you change the last time to :- <? array_multisort((array)$basename_i, SORT_ASC, (array)$report_files_x); ?> ...adding the (array) cast doesn't sort the main array ... ---- Server IP: 66.207.199.35 Probable Submitter: 209.112.47.82 ---- Manual Page -- http://www.php.net/manual/en/function.array-multisort.php Edit -- https://master.php.net/note/edit/71492 Del: integrated -- https://master.php.net/note/delete/71492/integrated Del: useless -- https://master.php.net/note/delete/71492/useless Del: bad code -- https://master.php.net/note/delete/71492/bad+code Del: spam -- https://master.php.net/note/delete/71492/spam Del: non-english -- https://master.php.net/note/delete/71492/non-english Del: in docs -- https://master.php.net/note/delete/71492/in+docs Del: other reasons-- https://master.php.net/note/delete/71492 Reject -- https://master.php.net/note/reject/71492 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120219) next »