note 57060 added to function.usort

From: Date: Thu, 22 Sep 2005 14:25:08 +0000
Subject: note 57060 added to function.usort
Groups: php.notes 
Request: Send a blank email to php-notes+get-95610@lists.php.net to get a copy of this message
A couple examples here advocate the use of 'create_function' for sorting, which is tempting to use because of the limitations of usort. But beware this method -- the function created will NOT be freed at the end of the sorting routine, which creates a memory leak. For this reason, this method should probably never be used. If you need multi-key or other complex sorting, the fundamental problem is passing in parameters into the comparison routine. I suggest creating a global variable (_array_key_multisort_parameters or something long), and controlling the comparison routine in that way. ---- Manual Page -- http://www.php.net/manual/en/function.usort.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57060 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57060&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57060&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57060&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57060&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57060&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57060&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57060&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57060&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95610) next »