Re: Unexpected behavior of max() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Because it returns alphabetical highest string.
You should change your locale or use dot instead of comma:

var_dump(
  max(array('100', '110*.*453351020813', '9'))
);


On 11 December 2012 10:48, "Рогулин С.В." <rogulin@xxxxxxxxx> wrote:

> Hi, dear subscribers.
>
> I encountered with unexpected behavior of max() function. When i pass a
> parameter ['100', '110,453351020813', '9'], this function gives answer '9'
>
> var_dump(
>   max(array('100', '110,453351020813', '9'))
> );
>
> // will output:
> // string(1) "9"
>
> I can`t understand this behaviour. Please explain this behavior.
>
> PHP 5.4.7 on FreeBSD 9.0-RELEASE-p4 amd64
>
> P.S.
> Sorry for my english :(
>
> --
> ----------------------------
> With best regards, Sergey Rogulin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux