473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

when to use 2 equal signs and when to use 3

When I had these two lines in my code:
if ($executed == "The command didn't exist") {
$this->core->error("In CommandRenderAllActionsInAnArray we sought
the command '$commandName' but ExteriorCommands could not find it. It
returned the value: '$executed'.", "CommandRenderAllActionsInAnArray");

I was getting this on screen:
# CommandRenderAllActionsInAnArray threw this error: In
CommandRenderAllActionsInAnArray we sought the command
'checkToSeeIfThisIsTheFirstLogin' but ExteriorCommands could not find
it. It returned the value: '1'.



But if I change the first line to this:
if ($executed === "The command didn't exist") {

then it works correctly.
Why does this need 3 equal signs? Why doesn't 2 suffice? I've done
string comparisons before and I've never had to use 3 equal signs
before.

Aug 7 '05 #1
2 5829
lk******@geocities.com wrote:
Why does this need 3 equal signs? Why doesn't 2 suffice? I've done
string comparisons before and I've never had to use 3 equal signs
before.


Have a close look at $executed. My guess is that it contains a boolean and
because a non-empty string equals boolean true with the lose ==
comparisation, you are getting the unexpected result. with === you are not
only comparing the values but also the types.
JW


Aug 7 '05 #2
>>>>>>>>>>>>>>>
Why does this need 3 equal signs? Why doesn't 2 suffice? I've done
string comparisons before and I've never had to use 3 equal signs
before.


Have a close look at $executed. My guess is that it contains a boolean
and
because a non-empty string equals boolean true with the lose ==
comparisation, you are getting the unexpected re
>>>>>>>>>>>


In other words, if $executed is boolean true, it doesn't matter what
the string is that I'm comparing it to, it still makes the if statement
acts as if the statement is true?

Aug 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: flm | last post by:
I've got an XML document that contains euro signs and looks like : <?xml version="1.0" encoding="utf-8"?> <merchant id="52"> <product offerid="03543068131" deliverycost="6,90 €" /> ....
8
by: Murt | last post by:
Hi, when writing equations in vb .net, how do you enter the signs "less than or equal to" etc. thanks Murt
17
by: Martin | last post by:
Below is some sample code to illustrate two warnings I get using a Hitachi compiler. When I use the GCC compiler I get a clean compile. I'd be grateful if someone could explain what the warnings...
1
by: Ine Embrechts | last post by:
I have a asp.net website based on an SQL Server database. There are texts in 8 languages in it. But I have problems showing the polish signs. How can I fix this? *** Sent via Developersdex...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
3
by: Paul E Collins | last post by:
In Visual Studio 2005, I copy a block of code with tabs in it, such as: myLabel.Text = "Please wait ..."; progressBar.Value = 0; (In the above, the two = signs are aligned with each other...
32
by: David Mark | last post by:
I've got a collection of functions that accept a function or object (paired with a method name) as a callback. For the longest time I have relied on this test. (typeof cb == 'function') ...
14
by: gimme_this_gimme_that | last post by:
What is going on here with the dollar signs and parenthesis? $(document).ready(function(){ $("li").behavior("click",function(){ $(this).load(menu.html"); }); }); And when do you use click...
0
by: RobR2009 | last post by:
I am having trouble with a C# proxy page I am writing which allows me to do cross domain AJAX calls with Javascript. The problem is with certain pages that contain pound signs £ that are not HTML...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.