Re: Someone please help me with this PHP script.
| From: | Łukasz Hejnak | Date: | Sun, 18 Dec 2005 17:17:21 +0000 |
| Subject: | Re: Someone please help me with this PHP script. | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-227616@lists.php.net to get a copy of this message | ||
Erik Johnson napisał(a):
Okay.. I was just wondering; What's the difference between = and ==? Would it matter if I changed them? It seems as though if I put = instead of the =='s, it comes up ONLY page two no matter what $page equals, and if it's ='s instead of =='s, then it comes up with only page one no matter what $page equals. It's a *BIG* difference!Because single '=' means that whatever stands at the right side of the '=' should be assigned to whatever stands at the left side, ie. $a=5 doesn't compare if a is equal 5, only assignes the variable 'a' it's value which will be 5 after this code so if You write if ($a=5) {...} it will always be executed (therefore else isn't executed), as assignment always returns true :] so when using 'if' You always need to do if ($a==5) {...} unless of course Youd want to do an assingment and some code, but then why not do $a=5; ... ? :) -- Best wishes Łukasz 'Szift' Hejnak