note 65517 added to function.max

From: Date: Tue, 02 May 2006 16:27:26 +0000
Subject: note 65517 added to function.max
Groups: php.notes 
Request: Send a blank email to php-notes+get-110376@lists.php.net to get a copy of this message
Regarding boolean parameters in min() and max(): (a) If any of your parameters is boolean, max and min will cast the rest of them to boolean to do the comparison. (b) true > false (c) However, max and min will return the actual parameter value that wins the comparison (not the cast). Here's some test cases to illustrate: 1. max(true,100)=true 2. max(true,0)=true 3. max(100,true)=100 4. max(false,100)=100 5. max(100,false)=100 6. min(true,100)=true 7. min(true,0)=0 8. min(100,true)=100 9. min(false,100)=false 10. min(100,false)=false 11. min(true,false)=false 12. max(true,false)=true ---- Server IP: 64.71.164.2 Probable Submitter: 63.172.193.57 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.max.php Edit -- http://master.php.net/note/edit/65517 Del: integrated -- http://master.php.net/note/delete/65517/integrated Del: useless -- http://master.php.net/note/delete/65517/useless Del: bad code -- http://master.php.net/note/delete/65517/bad+code Del: spam -- http://master.php.net/note/delete/65517/spam Del: non-english -- http://master.php.net/note/delete/65517/non-english Del: in docs -- http://master.php.net/note/delete/65517/in+docs Del: other reasons-- http://master.php.net/note/delete/65517 Reject -- http://master.php.net/note/reject/65517 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#110376) next »