note 36281 added to function.array-multisort
| From: | Lorenzo at rn2 dot php dot net | Date: | Fri, 03 Oct 2003 09:52:44 +0000 |
| Subject: | note 36281 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-57670@lists.php.net to get a copy of this message | ||
In response to the posting by hav0x on 04-Apr-2003,
I found a way around the problem of submitting the paramters such as SORT_ASC, etc from a variable:
Use the constant() function (see www.php.net/manual/en/function.constant.php).
Example:
array_multisort($Array1, constant("$SortOrder"), constant("$SortType"),
$Array2);
Where $SortOrder or $SortType might be passed through another function, or from an html form.
You just need to make sure that the content of these variables is the literal string of the constant
you wish to use (e.g. 'SORT_ASC').
HTH.
Lorenzo.
----
Manual Page -- http://www.php.net/manual/en/function.array-multisort.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36281
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36281&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36281&report=yes