php -a
Interactive mode enabled
php > 2+5
php > echo 2+5;
PHP Parse error: syntax error, unexpected 'echo' (T_ECHO) in php shell code on line 2
php > echo 2+5;
7
Please explain this weird result.
Two echo 2+5; have different results
php -a
Interactive mode enabled
php > 2+5
php > echo 2+5;
PHP Parse error: syntax error, unexpected 'echo' (T_ECHO) in php shell code on line 2
php > echo 2+5;
7
Please explain this weird result.
Two echo 2+5; have different results
Because you are missing a semicolon the first time, it thinks your statement has not ended.
is equivalent to
<code>2+5 echo 2+5;</code>
This is usually a grammatical error. As the brother above said, a semicolon is missing;