--- Alexander Skwar <[EMAIL PROTECTED]> wrote:
> So sprach 1LT John W. Holmes am 2003-01-27 um 15:49:33
> -0500 :
> > Actually, "08" is equal to 8 in PHP. PHP will convert
> > the string to an
>
> No, that's not true:
>
> if ("08" == 8){ echo "equal"; }
> if ("08" === 8){ echo "more equal"; }
>
So sprach 1LT John W. Holmes am 2003-01-27 um 15:49:33 -0500 :
> Actually, "08" is equal to 8 in PHP. PHP will convert the string to an
No, that's not true:
if ("08" == 8){ echo "equal"; }
if ("08" === 8){ echo "more equal"; }
This will only print "equal" and not "more equal".
Alexander Skwar
-
Your bug is this:
inconsistency of types.
You split a formatted string into smaller strings and compare the
integers to it. In order to do this correctly, you will need to take
your integers and convert them into the strings, format of which you
already know and used for deformatting the origina
just try doing it with === (three equal signs) and you'll see what is
where
--
Maxim Maletsky
[EMAIL PROTECTED]
"Cal Evans" <[EMAIL PROTECTED]> wrote... :
> John.
>
> > Actually, "08" is equal to 8 in PHP. PHP will convert the string to an
> >integer and the two will compare as equal.
>
> N
"Scott Fletcher":
> Okay, correction...
>
> Double --> 11.1237
> Float --> 0.
>
> Cheers! It's the way it work in C Programming... Double won't be as
long
> or as infinite as the floating point.
Absolutely wrong (if you would be in a C newsgrou
Okay, correction...
Double --> 11.1237
Float --> 0.
Cheers! It's the way it work in C Programming... Double won't be as long
or as infinite as the floating point.
"White Wolf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMA
"Scott Fletcher" wrote:
> Double and Float are not exactly the same thing.
>
> Double is ---> 11.123
> Float is --> .00238823993
I am absolutely new to PHP but what is above (since PHP seems to take most
of its low-level terminology from C) is a fixed point number and the next
is a floating po
--- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> Double and Float are not exactly the same thing.
>
> Double is ---> 11.123
> Float is --> .00238823993
They are the same thing. Please, read this:
http://www.php.net/manual/en/language.types.php
and this:
http://www.php.net/manual/en/language
() for float...
strval() for string
settype() for whatever..
intval() for integer
Um, what about double???
Thanks,
Scott F.
"Chris Hayes" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Re: [PHP] Fo
Another workaround to this problem is as an addition to Kirk Johnson's
suggestion
--clip--
$month = "08";
if (trim($month) == 8) {
echo "You got it!!!";
}
--clip--
"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECT
Aw nut!!! The intval() doesn't work.. I had enough, I'm going to do
what Kirk Johnson recommend. That one work better.
"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Yea, it's too bad that not many people know about it. I first aske
ooked 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 c
> >>
> >>
> >programming.
> >
> >
Yea, it's too bad that not many people know about it. I first asked and
they told me it is done automatically. That was 3 years ago. I never had a
problem for 3 years until now. So, I'm going back to the old way as I did
in Javascript and C programming. I first started PHP 3 years ago, so it's
John.
> Actually, "08" is equal to 8 in PHP. PHP will convert the string to an
>integer and the two will compare as equal.
No they are not equal. Yes, PHP will do the conversion so that they are
equal. That does not refute the fact that logically '08' != 8.
> Someone already posted why the prob
dle the type casting.
---John Holmes...
- Original Message -
From: "Ray Hunter" <[EMAIL PROTECTED]>
To: "Scott Fletcher" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, January 27, 2003 3:45 PM
Subject: Re: [PHP] Found a PHP bug!
> U mi
) for string
settype() for whatever..
intval() for integer
Um, what about double???
Thanks,
Scott F.
"Chris Hayes" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>Re: [PHP] Found a PHP bug!
uh oh...
I
> Because "8" != 8. "8" (and "08") is a string with the numerals
representing
> the number eight. It is not the number eight. (think back to basic math,
the
> difference between a number and a numeral)
Actually, "08" is equal to 8 in PHP. PHP will convert the string to an
integer and the two will
U might want to do a type cast to integer from string...
http://www.php.net/manual/en/language.types.type-juggling.php
On Mon, 2003-01-27 at 13:47, Scott Fletcher wrote:
> I would need to use intval() to solve this problem
>
> "Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
> [EMAIL P
I would need to use intval() to solve this problem
"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm referring to '08' and '09' that don't work
>
> "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL
integer
>
> Um, what about double???
>
> Thanks,
> Scott F.
>
> "Chris Hayes" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > >Re: [PHP] Found a PHP bug!
> > uh oh...
>
tval() for integer
Um, what about double???
Thanks,
Scott F.
"Chris Hayes" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> >Re: [PHP] Found a PHP bug!
> uh oh...
>
>
> >I don't see why a string wou
I'm referring to '08' and '09' that don't work
"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> --- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> > Found a PHP bug
> ...
> > if ($month == 01)
>
> I guess you mean:
>
> if ($month == '01')
>
> If
>Re: [PHP] Found a PHP bug!
uh oh...
I don't see why a string wouldn't work when I use "08" (string) and match it
against the integer 8, or 08.
They're just different types. Normally PHP is veeery flexible with
types, like javascript, but it just ca
")==8
=C=
*
* Cal Evans
* Stay plugged into your audience.
* http://www.christianperformer.com
*
-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 27, 2003 2:14 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Found a PHP bug!
I don
--- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> Found a PHP bug
...
> if ($month == 01)
I guess you mean:
if ($month == '01')
If so, this is not a bug. Otherwise, please explain what
you think is wrong.
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.
I don't see why a string wouldn't work when I use "08" (string) and match it
against the integer 8, or 08.
"Kirk Johnson" <[EMAIL PROTECTED]> wrote in message
B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef...
>
> > -Original Message-
> > From
> -Original Message-
> From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
>
> 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
I stumbled into this one a short while ago myself. It is not a b
On Tuesday 28 January 2003 03:56, Scott Fletcher wrote:
> 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, so I
> have been playing around it and found the problem. I recently wrote a demo
> script for y
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, so I have
been playing around it and found the problem. I recently wrote a demo
script for you all to play around with. Let me know which PHP version does
29 matches
Mail list logo