Re: note 9262 added to echo

From: Date: Thu, 26 Oct 2000 00:38:36 +0000
Subject: Re: note 9262 added to echo
Groups: php.notes 
Request: Send a blank email to php-notes+get-6984@lists.php.net to get a copy of this message
Check the "Type juggling" section of the manual. This is the documented behavior. You are using a string operator (namely the dot ".") and when mixed with other variables you typecast them to string. Your note has been removed. --- uioreanu@hotmail.com wrote: > Hello, > Don't waste time like me on this: > > <font face=Arial size=2> > <?php > > $Str_Year = 2000; > echo "year= "; > echo $Str_Year; > echo ", year+1 is "; > echo $Str_Year+1; > /* > HTML Output: > year is 2000 year+1 is 2001 > Output ok > */ > echo "<br> year= ".$Str_Year.", year+1 = ". > $Str_Year+1; > /* > HTML Output: > 1 > Output bad > */ > echo "<br> year= ".$Str_Year.", year+1 = ". > ($Str_Year+1); > /* > HTML Output: > year= 2000, year+1 = 2001 > Output Ok > */ > > ?> > <br> > Why that 1? > $foo = "10.0 pigs " + 1; // $foo is integer > (11) > ... > Take care! > > http://www.php.net/manual/function.echo.php > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-notes-unsubscribe@lists.php.net > For additional commands, e-mail: > php-notes-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) __________________________________________________ Do You Yahoo!? Yahoo! Messenger - Talk while you surf! It's FREE. http://im.yahoo.com/

« previous php.notes (#6984) next »