note 84861 rejected from function.abs by danbrown
| From: | danbrown@php.net | Date: | Sat, 02 Aug 2008 17:18:59 +0000 |
| Subject: | note 84861 rejected from function.abs by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143055@lists.php.net to get a copy of this message | ||
Note Submitter: lkj d0t korn
----
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.