[thelist] PHP question... checking string length
Christian Heilmann
lists at onlinetools.org
Fri Mar 25 12:26:16 CST 2005
Theodore Serbinski wrote:
>Guys, got a quick question. In PHP, I usually test if a string is empty like so:
>
>if ($myString=='') // do something
>
>But I recently stumbled upon some code from a much more experienced
>PHP person test empty strings like so:
>
>if (strlen($myString) == 0) // do something
>
>Is there any difference/advantage to using one over the other? Only
>apparently one is using the first method should be marginally faster
>(no function call). Thanks!
>
>
The latter actually assumes that $myString is a string an
More information about the thelist
mailing list