[thelist] PHP question... checking string length
Burhan Khalid
thelist at meidomus.com
Sat Mar 26 08:14:51 CST 2005
Mark Groen wrote:
> On Sat, 26 Mar 2005 10:31:47 +0300, Burhan Khalid <> wrote:
>
>
>>Suprised no one mentioned if ('' === $myString), which is type-safe.
>
>
> I've seen that triple equals used before, and Googled for it a bunch
> but still not sure what it means exactly, could you elaborate please?
A triple === adds type checking to your conditional.
For example,
$var = 1;
$var2 = "1";
if ($var == $var2) { echo "loose-type checking -- equal"; }
/* This will never print */
if ($var === $var2) { echo "strict type checking -- equal"; }
See http://www.php.net/manual/en/language.operators.comparison.php
Hope this helps,
Burhan Khalid
More information about the thelist
mailing list