Re: Found a PHP bug!!!!!!!!!
| From: | Leif K-Brooks | Date: | Mon, 27 Jan 2003 21:35:26 +0000 |
| Subject: | Re: Found a PHP bug!!!!!!!!! | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133302@lists.php.net to get a copy of this message | ||
doubleval
doubleval -- Alias of floatval() <http://www.php.net/manual/en/function.floatval.php>
Description
This function is an alias of floatval() <http://www.php.net/manual/en/function.floatval.php>.
Note: This alias is a left-over from a function-renaming. In older
versions of PHP you'll need to use this alias of the floatval()
<http://www.php.net/manual/en/function.floatval.php> function,
because floatval()
<http://www.php.net/manual/en/function.floatval.php> wasn't yet
available in that version.
Scott Fletcher wrote:
Double and Float are not exactly the same thing. Double is ---> 11.123 Float is ------> .00238823993 "Leif K-Brooks" <eurleif@buyer-brokerage.com> wrote in message news:3E359A94.7070406@buyer-brokerage.com...INo, it's floatval. Doubleval is an alias left over from hwen floats were called doubles... Scott Fletcher wrote:Whoop! FOund it, it is doubleval()... What does settype() do exactly???? "Scott Fletcher" <scott@abcoa.com> wrote in message news:20030127203843.29862.qmail@pb1.pair.com...I do know that integer, string, double, float, etc.... are different..
Ihave been using hte appropriate method like in javascript and cprogramming,like converting it to integer and so on.... But when I start using PHP,
afind no such document of it and I have been using it for 3 years without
correctproblem. I asked people is there such a thing as converting it by usingthefunction and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will
matchuh oh...the problem with the php script... I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up. Okay, I'm going back to my old way as I did in javascript and cprogramming.So for php, it would be floatval() for float... strval() for string.... settype() for whatever...... intval() for integer.... Um, what about double??? Thanks, Scott F. "Chris Hayes" <chayes@antenna.nl> wrote in message news:5.1.1.6.0.20030127211703.014c47f8@pop4.antenna.nl...Re: [PHP] Found a PHP bug!!!!!!!!!I don't see why a string wouldn't work when I use "08" (string) and
it
against the integer 8, or 08.
They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here
because
it needs to choose the most logic to the entire pool of programmers,
and
[other]then"08" = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in
I stumbled into this one a short while ago myself. It is not a bug,itprogramming languages, for example you want it to be treated as aninteger,PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value asis used in a calculation or an if() statement) or settype (alters the variable)."Kirk Johnson" <kjohnson@zootweb.com> wrote in message news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef...-----Original Message----- From: Scott Fletcher [mailto:scott@abcoa.com] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September
but a
feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP
interprets
them as octal numbers (because of the leading 0). However, 08 and 09
are
invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type
conversion
to
int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes
the
leading zero); Kirk
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.