You are here: Re: [PHP] Someone please help me with this PHP script. « PHP « IT news, forums, messages
Re: [PHP] Someone please help me with this PHP script.

Posted by £ukasz Hejnak on 12/18/05 19:17

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

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация