note 9262 added to echo
| From: | uioreanu at hotmail dot com | Date: | Wed, 25 Oct 2000 11:54:13 +0000 |
| Subject: | note 9262 added to echo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6900@lists.php.net to get a copy of this message | ||
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