From:             csaba at alum dot mit dot edu
Operating system: All
PHP version:      4.3.0
PHP Bug Type:     Documentation problem
Bug description:  max not returning a number

max(array("tdCommon", 0)) => "tdCommon"    // not a number

The documentation at php.net/max claims:
If one or more of the values is a float, all the values will be treated as
floats, and a float is returned. If none of the values is a float, all of
them will be treated as integers, and an integer is returned. 


Evidently, the behaviour of this function was intended to change
(extrapolating from http://bugs.php.net/bug.php?id=2676 (bug # 2676)).

This should be reflected in the documentation.  (I was trying to get the
key of the most recent element I had created in a "semi-associative" array
by $array[] = $newVal and max as advertised would have done the trick. 
Could it still work?  I don't know, because I don't really know what it's
supposed to be doing anymore.  For example, what type of sort is being
done now?).

Csaba Gabor
-- 
Edit bug report at http://bugs.php.net/?id=22565&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22565&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22565&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22565&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22565&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22565&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22565&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22565&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22565&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22565&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22565&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22565&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22565&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22565&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22565&r=gnused


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to