Posted by Rik Wasmus on 11/20/07 16:50
On Tue, 20 Nov 2007 16:32:13 +0100, VooDoo <VooDooNet38@free.fr> wrote:
> Hi,
> I am getting confused with sorting arrays...
> $arraytest =3Darray(5) { [0]=3D> string(2) "39" [1]=3D> string(2) "44"=
[2]=3D>
> string(2) "77" [3]=3D> string(3) "150" [4]=3D> string(3) "464" }
>
> why do i get NULL value if i try to sort this array using sort command=
?
>
> sort($arraytest);
Probably, because sort() works by reference, not return:
$arraytest =3D sort($arraytest);
//=3D>$arraytest =3D true or false; $arraytest[N] =3D NULL
sort($arraytest);
//=3D>$arraytest =3D sorted array; $arraytest[N] =3D set value or NULL i=
f =
non-existant
-- =
Rik Wasmus
[Back to original message]
|