Re: navigation include not functioning (RESOLVED)

From: Date: Thu, 06 Aug 2009 02:14:01 +0000
Subject: Re: navigation include not functioning (RESOLVED)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-296368@lists.php.net to get a copy of this message
On Wed, Aug 05, 2009 at 02:55:07PM -0700, Ben Dunlap wrote: > > In my navigation.php include file, I had if ($page = about) echo href.... > > I changed it to if ($page == about) echo.... and it suddenly > worked! Imagine > > that... > > Another good case for putting the variable on the right side of "==": > > if ("about" == $page) > > Then if you mis-type "==" as "=", PHP will fail immediately with a parse > error. > > It feels a little weird but if it saves a lot of head-desk moments it's > probably worth it. Now if only I could get into the habit myself... This is common practice for a lot of C programmers for exactly this reason. Paul -- Paul M. Foster

« previous php.general (#296368) next »