note 63217 added to function.min

From: Date: Thu, 16 Mar 2006 10:16:46 +0000
Subject: note 63217 added to function.min
Groups: php.notes 
Request: Send a blank email to php-notes+get-105900@lists.php.net to get a copy of this message
> NEVER EVER use this function with boolean variables !!! > Or you'll get something like this: min(true, 1, -2) == true; > Just because of: > min(true, 1, -2) == min(min(true,1), -2) == min(true, -2) == true; It is possible to use it with booleans, there is is just one thing, which you need to keep in mind, when evaluating using the non strict comparison (==) anyting that is not bool false, 0 or NULL is consideret true eg.: (5 == true) = true; (0 == true) = false; true is also actually anything else then 0, false and null. However when true is converted to a string or interger true == 1, therefore when sorting true = 1. But if true is the maximum number bool true is returned. so to be sure, if you only want to match if true is the max number remember to use the strict comparison operater === ---- Server IP: 195.184.96.15 Probable Submitter: 80.198.16.23 ---- 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.min.php Edit -- http://master.php.net/note/edit/63217 Del: integrated -- http://master.php.net/note/delete/63217/integrated Del: useless -- http://master.php.net/note/delete/63217/useless Del: bad code -- http://master.php.net/note/delete/63217/bad+code Del: spam -- http://master.php.net/note/delete/63217/spam Del: non-english -- http://master.php.net/note/delete/63217/non-english Del: in docs -- http://master.php.net/note/delete/63217/in+docs Del: other reasons-- http://master.php.net/note/delete/63217 Reject -- http://master.php.net/note/reject/63217 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105900) next »