You are here: Re: is_blank()? « PHP Programming Language « IT news, forums, messages
Re: is_blank()?

Posted by Hendri Kurniawan on 05/11/07 02:49

Mike P2 wrote:
> On May 10, 10:38 pm, Hendri Kurniawan <ask...@email.com> wrote:
>> Man-wai Chang wrote:
>>
>>> How could I check whether a string variable contains nothing but space?
>>> empty() does not work unless the string variable is "".
>> empty(trim($variable));
>>
>> Hendri Kurniawan
>
> Actually, that will return false if the string is ' 0 ' because the
> number 0 is considered emptyness by empty(). The right way to do it
> is:
>
> if( trim( $variable ) == '' )
>
> empty() will also make sure the variable is set for you. You don't
> have this luxury since you are using trim() and an operator, so you
> may have to do this instead:
>
> if( !isset( $variable ) || trim( $variable ) == '' )
>
> ...if you are validating input.
>
> -Mike PII
>

Yes true :)

Hendri Kurniawan

 

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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация