holowugz Posted March 22, 2006 Share Posted March 22, 2006 Hell again guys,ok this is my conditional statementLif($class !== 7) {header("Location: ". $redirectSuccess);exit;}basically i am saying if $class is not 7 follow that instruction but it cycles through the statement anyway, what i am testing it on the vlaue of class is DEFINITELY 7any ideas? Quote Link to comment Share on other sites More sharing options...
jeepin81 Posted March 22, 2006 Share Posted March 22, 2006 get rid of the second equals sign and you should be all set.best-j. Quote Link to comment Share on other sites More sharing options...
holowugz Posted March 22, 2006 Author Share Posted March 22, 2006 [!--quoteo(post=357156:date=Mar 22 2006, 12:47 AM:name=jeepin81)--][div class=\'quotetop\']QUOTE(jeepin81 @ Mar 22 2006, 12:47 AM) [snapback]357156[/snapback][/div][div class=\'quotemain\'][!--quotec--]get rid of the second equals sign and you should be all set.best-j.[/quote]...? , i thought == is the comparison operator and = was the operator to set something to something:i.e $var = 7 (Is set To)if($var == 7) (if Var equals 7)does it differ in an if statement then? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 22, 2006 Share Posted March 22, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]...? , i thought == is the comparison operator and = was the operator to set something to something:i.e $var = 7 (Is set To)if($var == 7) (if Var equals 7)[/quote]Yes, that is true, but we're looking at conditional operators:== equal values!= not equal values=== equal types!== not equal typesThe difference here is usefull when comparing a return of "false" to a return of 0This code [code]<?php $x = 0;if ($x == false) echo "true"; else echo "false" ?>[/code]will print "true", while this code[code]<?php$x = 0;if ($x === false)echo "true"; esle echo "false" ?>[/code]will print "false".The first is comparing the values " 0 == 0" (false has the value of 0)The second is comparing types " integer != boolean "Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.