note 58808 deleted from function.sort by nlopess
| From: | nlopess@php.net | Date: | Wed, 16 Nov 2005 18:40:50 +0000 |
| Subject: | note 58808 deleted from function.sort by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98667@lists.php.net to get a copy of this message | ||
Note Submitter: kitty_zoso
----
When I tried the case insensitive sort
<?php
$array_var = Array("Cheery", "zap", "Banana", "apple",
"Zing");
array_multisort((strtolower($array_var)), SORT_ASC, SORT_STRING, $array_var);
?>
I got
PHP Notice: Array to string conversion in ...\ex7.php on line 77
PHP Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in
...\ex7.php on line 77
I'm a newbie - can anybody comment on this? What is the significance of the () around
strtolower($array_var)?
I think it works using this line instead:
array_multisort(array_map('strtolower', $array_var), SORT_ASC, SORT_STRING, $array_var);