Re: note 8379 added to array_multisort
| From: | J. M. Castagnetto | Date: | Sun, 10 Sep 2000 02:34:26 +0000 |
| Subject: | Re: note 8379 added to array_multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4631@lists.php.net to get a copy of this message | ||
Just to test this, I compiled 4.0.1pl2 (have 4.0.2 and
4.0.3-dev also) and run the example (modified):
<?
$ar = array (array ("10", 100, "a", 100), array (1, 3,
"2", 1));
array_multisort (&$ar[0], SORT_ASC, SORT_STRING,
&$ar[1], SORT_NUMERIC, SORT_DESC);
print_r($ar);
?>
4.0.1pl2 gives the indicated error, and $ar is not
sorted. In 4.0.2 $ar[0] gets sorted OK, but $ar[1] is
sorted in a strange way, because if it is being sorted
as number in descending order, the resulting array
should be: (3,2,1,1) and not (1,3,2,1)
Seems like a bug report to me.
Results:
4.0.1pl2:
<br>
<b>Warning</b>: Argument 3 to array_multisort() is
expected to be an array in <b>-</b> on line
<b>4</b><br>
Array
(
[0] => Array
(
[0] => 10
[1] => 100
[2] => a
[3] => 100
)
[1] => Array
(
[0] => 1
[1] => 3
[2] => 2
[3] => 1
)
)
4.0.2:
Array
(
[0] => Array
(
[0] => 10
[1] => 100
[2] => 100
[3] => a
)
[1] => Array
(
[0] => 1
[1] => 3
[2] => 1
[3] => 2
)
)
4.0.3:
Array
(
[0] => Array
(
[0] => 10
[1] => 100
[2] => 100
[3] => a
)
[1] => Array
(
[0] => 1
[1] => 3
[2] => 1
[3] => 2
)
)
--- ycshowtop@21cn.com wrote:
> I run the function in PHP4.0.1pl2,but get this
> error:
>
> Warning: Argument 3 to array_multisort() is expected
> to be an array in d:\test\test.php on line 4
>
> my code is the example 2.
>
>
>
http://www.php.net/manual/function.array-multisort.php
>
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/