NYCPHP Meetup

NYPHP.org

[nycphp-talk] ${$variable}

Emmanuel. M. Decarie emm at scriptdigital.com
Thu Aug 28 09:35:27 EDT 2003


À (At) 21:32 -0400 27/08/03, Hans Zaunere écrivait (wrote) :
>
>$bar = 0;
>if ($bar == '') {
>   echo '<br />bar equals empty';
>}
>
>makes output, and using  if( $bar === '' )   wouldn't.

I have been bitten so many times by this that I 
prefer this in my code. I find that its more 
explicit.

$bar = 0;
if ( strlen ($bar) == 0 ) {
   echo '<br />bar equals empty or not set';
} else {
	echo '<br />bar not empty';
}

Output: '<br />bar not empty'

#$bar = 0;
if ( strlen ($bar) == 0 ) {
   echo '<br />bar equals empty or not set';
} else {
	echo '<br />bar not empty';
}

Output: '<br />bar equals empty or not set'

Cheers
-Emmanuel



-- 
______________________________________________________________________
Emmanuel Décarie / Programmation pour le Web - Programming for the Web
<http://scriptdigital.com/> - Blog: 
<http://blog.scriptdigital.com> - AIM: 
scriptdigital



More information about the talk mailing list