Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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