Re: Someone please help me with this PHP script.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux