469,364 Members | 2,346 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,364 developers. It's quick & easy.

PHP Boolean Values like ASP

I'm traing to rewrite a part of code i've made in for ASP in PHP.

ASP:
If moneda = True Then
moneda = False
Else
moneda = NOT moneda
End If

This change the value of the variable from true to false and the other
way arround.

My problem is that PHP asumes that Null value is also False value.
So, I need three instances of the variable; when the variable was not
already user, to asume the Null value. If the value is Null, then to
change it to True, and when it is True to change it to false.
How can I solve this PHP misunderstud between Null and False value?

Thanks!
ELMICHA
Jul 16 '05 #1
5 6085

"Micha" <mi*******@tutopia.com> wrote in message
news:12**************************@posting.google.c om...
I'm traing to rewrite a part of code i've made in for ASP in PHP.

ASP:
If moneda = True Then
moneda = False
Else
moneda = NOT moneda
End If

This change the value of the variable from true to false and the other
way arround.

My problem is that PHP asumes that Null value is also False value.
So, I need three instances of the variable; when the variable was not
already user, to asume the Null value. If the value is Null, then to
change it to True, and when it is True to change it to false.
How can I solve this PHP misunderstud between Null and False value?

Thanks!
ELMICHA


Try:

if moneda === true
moneda = false;
else
moneda = true;

Jul 16 '05 #2

"Phlarmf" <no@email.com> wrote in message
news:rSj9b.6014$VS2.5155@pd7tw1no...

"Micha" <mi*******@tutopia.com> wrote in message
news:12**************************@posting.google.c om...
I'm traing to rewrite a part of code i've made in for ASP in PHP.

ASP:
If moneda = True Then
moneda = False
Else
moneda = NOT moneda
End If

This change the value of the variable from true to false and the other
way arround.

My problem is that PHP asumes that Null value is also False value.
So, I need three instances of the variable; when the variable was not
already user, to asume the Null value. If the value is Null, then to
change it to True, and when it is True to change it to false.
How can I solve this PHP misunderstud between Null and False value?

Thanks!
ELMICHA


Try:

if moneda === true
moneda = false;
else
moneda = true;


man... it's too early Monday... I forgot the braces on the if

if (moneda === true)


Jul 16 '05 #3
Micha wrote:
I'm traing to rewrite a part of code i've made in for ASP in PHP.

ASP:
If moneda = True Then
moneda = False
Else
moneda = NOT moneda
End If

This change the value of the variable from true to false and the other
way arround.


$bMoneda = $bMoneda ? false : true;

--
Dado

What this world needs is a good five-dollar plasma weapon.
Jul 16 '05 #4
Micha writes:
How can I solve this PHP misunderstud between Null and False value?


Do you know about the === and !== operators? They test for equality
of both value and type. So the expression (false === null ) evaluates
to false.

--

__o Alex Farran
_`\<,_ Analyst / Programmer
(_)/ (_) www.alexfarran.com

Jul 16 '05 #5
Alex Farran <al**@alexfarran.com> wrote in message news:<m3************@alexfarran.com>...
Micha writes:
How can I solve this PHP misunderstud between Null and False value?


Do you know about the === and !== operators? They test for equality
of both value and type. So the expression (false === null ) evaluates
to false.


It worked fine!!
Thanks to all...
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Julian Hershel | last post: by
8 posts views Thread by FrancisC | last post: by
17 posts views Thread by jacob navia | last post: by
8 posts views Thread by Metro Sauper | last post: by
reply views Thread by ECathell | last post: by
10 posts views Thread by dba123 | last post: by
6 posts views Thread by =?iso-8859-2?Q?Marcin_Dzi=F3bek?= | last post: by
19 posts views Thread by tshad | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.