Solved

IF statements

Posted on 2000-03-15
2
200 Views
Last Modified: 2008-03-06
Why does the following statement act as if the "IF" wasn't there?
if ($variable = "x y") {variable2 = 10;}

??? It assumes I mean:
variable2 = 10;

*confused*

Cheers,
Dave
0
Comment
Question by:dht1
2 Comments
 

Accepted Solution

by:
mrvithan earned 50 total points
Comment Utility
Well... 'cause you use wrong condition... for logic, you have to use '==' instend. That at mean ... if($variable == "x y") {$variable2 = 10}
0
 

Author Comment

by:dht1
Comment Utility
Doh!  Thanks.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now