Ask: Why for ($i =1; $i <=10;print $i + +); Can't I change the print to echo?
Reply to discussion (solution)
for ($i =1; $i <=10;echo $i + +);
Parse error:syntax error, unexpected ' echo ' (T_echo), expecting ') ' in ....
That's what it's all about.
What exactly is the need to print on for?
It's a strange notation.
for ($i =1; $i <=10;echo $i + +);
Parse error:syntax error, unexpected ' echo ' (T_echo), expecting ') ' in ....
That's what it's all about.
Start to think whether it is the return value of print and echo problem, but also want to understand, want to understand, seek guidance!
What exactly is the need to print on for?
Not the actual project, is to see the manual found the problem ...
It's a strange notation.
It's kind of weird, it's not usually written like that.
for ($i =1; $i <=10;echo $i + +);
Parse error:syntax error, unexpected ' echo ' (T_echo), expecting ') ' in ....
That's what it's all about.
Start to think whether it is the return value of print and echo problem, but also want to understand, want to understand, seek guidance!
Yes, it's a question of return value, ECHO has no return value, so it's not allowed to write.
Wrong syntax, change it.
for ($i =1; $i <=10; $i + +) { echo $i;}
Wrong syntax, change it.
for ($i =1; $i <=10; $i + +) { echo $i;}
I know it can be written like this, just to figure out why Echo replaces print with an error when a line is written.
for ($i = 1; $i <=; Echo $i, $i + +);
It's a really weird notation.
Wrong syntax, change it.
for ($i =1; $i <=10; $i + +) { echo $i;}
I know it can be written like this, just to figure out why Echo replaces print with an error when a line is written.
The moderator has already answered you, because print succeeds always returns 1, and Echo has no return value, so the original statement is equivalent for ($i =1; $i <=10;1) {$i + +;} And for ($i =1; $i <=10;) {$i + +;}, obviously echo will go wrong.
Endorsement 7 Floor +1