Home > Backend Development > PHP Tutorial > unexpected 'echo' (T_ECHO) in php shell code

unexpected 'echo' (T_ECHO) in php shell code

WBOY
Release: 2016-08-18 09:16:36
Original
4123 people have browsed it

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

Reply content:

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>
Copy after login

This is usually a grammatical error. As the brother above said, a semicolon is missing;

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template