473,554 Members | 4,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6267

"Micha" <mi*******@tuto pia.com> wrote in message
news:12******** *************** ***@posting.goo gle.com...
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@pd7tw 1no...

"Micha" <mi*******@tuto pia.com> wrote in message
news:12******** *************** ***@posting.goo gle.com...
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**@alexfarra n.com> wrote in message news:<m3******* *****@alexfarra n.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3874
by: Julian Hershel | last post by:
Hi. I want to to use the xs:boolean type for one of my elements. But is it possible to make these boolean values be read as Yes/No instead of true/false? Should I create a custom type for that? Thank you. Julian
8
43958
by: FrancisC | last post by:
how to define Boolean in C ? boolean abc; ??? is it default as True or False??
17
1710
by: jacob navia | last post by:
The section about boolean values should mention <stdbool.h> at least. It is still at the C89 stage... (Section 9)
8
3251
by: Metro Sauper | last post by:
Why is the default text representation for booleans in C# 'True' and 'False' whereas in xml it is 'true' and 'false'? It seems like it would make sense to have them both the same. Metro T. Sauper, Jr. President Sauper Associates, Inc.
0
1268
by: Robert Love | last post by:
I am trying to save some boolean values from checkboxes using isolated storage. I am able to do strings and integers without a problem but I can't work out how to save boolean values without seeing the error message below: 'Additional information: Argument 'Prompt' cannot be converted to type 'String' The error message is displayed at...
0
1373
by: ECathell | last post by:
Ok this may be a silly question...but here goes... I need to extend the boolean type. the reason for this is I have a base collection that has boolean properties. Then my inherited class has enumerated values that configure the Boolean value of the underlying class. The issue is I have a confirmation box that shows changed fields in my...
10
16391
by: dba123 | last post by:
Why am I getting this error for Budget? Error: An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code Additional information: String was not recognized as a valid Boolean. Public Sub UpdateCustomer_DashboardGraphs(ByVal sender As Object, ByVal e As System.EventArgs)
0
1251
by: Genken | last post by:
Hi ALL I currently have a project where i have to redefine certain table fields and their data types. The problem is i have fields to mimic or duplicate an access table, but the problem is that certain fields are boolean values with yes/no attributes. Sql server does not support boolean values to my understanding. The sql server...
6
17493
by: =?iso-8859-2?Q?Marcin_Dzi=F3bek?= | last post by:
Hi All: I need to get (filter in) some dataview's rows with DBNULLs in column of boolean type: Actually to get the only rows with DBNULL, I use code like this: DV.RowFilter = "(IsNull(MyBooleanColumnName, True) = True) AND (IsNull(MyBooleanColumnName, False) = False)" or ex. DV.RowFilter = "(IsNull(MyIntegerColumnName, 1) = 1) AND...
19
14759
by: tshad | last post by:
I have a value in my sql table set to tinyint (can't set to bit). I am trying to move it into a boolean field in my program and have tried: isTrue = (int)dbReader and isTrue = Convert.ToBoolean((int)dbReader)
0
7620
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7900
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6172
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3571
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1154
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
861
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.