note 84861 added to function.abs
| From: | lkjd0tkorn at osu1 dot php dot net | Date: | Sat, 02 Aug 2008 06:52:14 +0000 |
| Subject: | note 84861 added to function.abs | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143049@lists.php.net to get a copy of this message | ||
Additional notes to my previous post.
"(as PHP turns it automatically into a string or float)"
I mean to say "(as PHP turns strings automatically into an integer or float)".
Another thing I'd like to note is that the variable name $integer used in my examples
aren't really advised as the function goes beyond simple integers. Initially, I used this
function only for the handling of integers, hence the variable name. It is only later that I've
discovered it goes beyond integers. 0 will also return to 0 (if that shouldn't be obvious).
Perhaps it is better to make it return NULL instead of FALSE when it fails the is_numeric condition,
so that there's no mix with the function's result to be false instead of actually 0,
however only checking with '===' instead of '==' should solve this, I believe.
----
Server IP: 64.71.164.2
Probable Submitter: 66.91.94.7
----
Manual Page -- http://www.php.net/manual/en/function.abs.php
Edit -- https://master.php.net/note/edit/84861
Del: integrated -- https://master.php.net/note/delete/84861/integrated
Del: useless -- https://master.php.net/note/delete/84861/useless
Del: bad code -- https://master.php.net/note/delete/84861/bad+code
Del: spam -- https://master.php.net/note/delete/84861/spam
Del: non-english -- https://master.php.net/note/delete/84861/non-english
Del: in docs -- https://master.php.net/note/delete/84861/in+docs
Del: other reasons-- https://master.php.net/note/delete/84861
Reject -- https://master.php.net/note/reject/84861
Search -- https://master.php.net/manage/user-notes.php