• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

IF statements

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
dht1
Asked:
dht1
1 Solution
 
mrvithanCommented:
Well... 'cause you use wrong condition... for logic, you have to use '==' instend. That at mean ... if($variable == "x y") {$variable2 = 10}
0
 
dht1Author Commented:
Doh!  Thanks.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now