Re: Php ignores if statement

From: Date: Sat, 22 Nov 2003 22:53:15 +0000
Subject: Re: Php ignores if statement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-170691@lists.php.net to get a copy of this message
--- Pieter <PieterDT@telkomsa.net> wrote: > I recently started coding online and i have the weirdest response, > my code is: > > if ($id = "add" ) When you convert the string "add" to a boolean, it equates to true. I'm assuming you want to be using a conditional expression rather than an assignment statement. Either this was a typo, or you should really read a lot of introductory material on PHP's syntax, as I'm guessing this is your first programming language. Start with the PHP manual: http://www.php.net/manual/ Expressions are discussed here: http://www.php.net/manual/en/language.expressions.php PHP's conditional expressions are given as follows: -------------------------------------------------- PHP supports > (bigger than), >= (bigger than or equal to), == (equal), != (not equal), < (smaller than) and <= (smaller than or equal to). -------------------------------------------------- Hope that helps. Chris ===== Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp

« previous php.general (#170691) next »