Re: Unexpected behavior of max() function
| From: | Rodrigo Silva dos Santos | Date: | Tue, 11 Dec 2012 11:16:49 +0000 |
| Subject: | Re: Unexpected behavior of max() function | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319834@lists.php.net to get a copy of this message | ||
A solution to it is, if you can, enter the array itens without the commas, just array(100,110.453351020813,9);
Em 11-12-2012 05:05, Andreas Perstinger escreveu:
On 11.12.2012 07:48, "Рогулин С.В." wrote:I encountered with unexpected behavior of max() function. When i pass a parameter ['100', '110,453351020813', '9'], this function gives answer '9' var_dump(As the output tells you, you are comparing strings and the character '9' is greater than the character '1' (at the beginning of the two other strings). Bye, Andreasmax(array('100', '110,453351020813', '9'))); // will output: // string(1) "9"