Ask a Question related to PHP Development, Design and Development.
-
J-P #1
Why strange IF...ELSE behavior
Hi all,
I'm getting a strange result with the following IF statement:
$bar = ($foo == 'last') ? true : false;
In my script $foo normaly has a integer value greater than 0, but can have
last as value. But whatever value of $foo $bar always becomes true.
When I use the regular if {....}else{....} I get the same result, always
$bar becomes true.
I've played around with a couple things, like turning the statement around
($foo != 'last') but nothing seems to give the desired result.
Can anyone tell me what I'm doing wrong or how to fix this.
Thanx,
J-P
J-P Guest
-
Strange behavior
The problem seems to be in c code calling ruby calling c code. ======== start test.rb puts "about to require curses" require "curses" puts... -
Strange behavior of $.
Apparently $. is not always set correct (see second ruby 1liner). Is this a bug? 12:12:42 : cat -n n 1 2 3 BAR="hello" 4 12:12:47 : ruby... -
Re[2]: Strange behavior of DBI/DBD::Informix
Thank you for the reply. Sorry, I wrote late in the evening and forgot to post my configuration: Perl 5.6.1 AIX 4.2.1 (I know it's old... -
Strange behavior of DBI/DBD::Informix
I tried sending this problem to the address specified in DBD::Informix::TechSupport (perldoc) - dbd-informix@us.ibm.com but... -
Strange behavior of DBD/DBI Informix
I am not sure if this list is the best one to post to regarding this problem. If not please point me to the better one. Consider the following... -
P'tit Marcel #2
Re: Why strange IF...ELSE behavior
J-P écrivit:
It's due to the silent type casting of php> Hi all,
>
> I'm getting a strange result with the following IF statement:
>
> $bar = ($foo == 'last') ? true : false;
>
> In my script $foo normaly has a integer value greater than 0, but can
> have last as value. But whatever value of $foo $bar always becomes
> true.
you should use === instead of ==
--
P'tit Marcel
P'tit Marcel Guest
-
J-P #3
Re: Why strange IF...ELSE behavior
Thanx that did it, never to late to learn something.>
> It's due to the silent type casting of php
> you should use === instead of ==
>
J-P Guest



Reply With Quote

