ID: 38883
Updated by: [EMAIL PROTECTED]
Reported By: ryanhollett at hotmail dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Windows XP sp2
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"PHP will evaluate a non-numeric string as 0 if compared to integer,
..."
Previous Comments:
------------------------------------------------------------------------
[2006-09-19 15:34:40] ryanhollett at hotmail dot com
This was tested on version 4.4.0, 4.4.1, 4.4.4 for Windows. This may
be a documentation problem or an issue with the function itself
depending on the intended functionality.
------------------------------------------------------------------------
[2006-09-19 15:31:54] ryanhollett at hotmail dot com
Description:
------------
>From the php documentation for the min function "PHP will evaluate a
non-numeric string as 0, but still return the string if it's seen as the
numerically lowest value."
It seems that this is incorrect. When a non-numeric string and a
numeric string are passed in, the numeric string seems to be returned as
the the min value.
Reproduce code:
---------------
<?php
echo min("a", "2");
echo "\n";
echo min("2", "a");
echo "\n";
echo min("a", "-2");
echo "\n";
echo min("-2", "a");
?>
Expected result:
----------------
a
a
-2
-2
Actual result:
--------------
2
2
-2
-2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38883&edit=1