[thelist] PHP question... checking string length

Mike evolt at muinar.com
Fri Mar 25 15:39:11 CST 2005


At 12:30 25.03.2005 -0500, you 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

Hello

if( ! $myString ) // do something

would do it as well. Because, if the string is empty, it doesn't
exist.

Cheers

Mike

_____  mike s. krischker  http://webdesign-schweiz.ch/
        webpro mailing list  http://webdesign-list.com/
        flashpro mailing list  http://flash-list.com/



More information about the thelist mailing list