でもprintは使える。
<?php
for($i=0;$i++<10;echo $i); // Parse error: syntax error, unexpected 'echo'
for($i=0;$i++<10;print $i); // 12345678910
while($i++<10 && echo $i); // Parse error: syntax error, unexpected 'echo'
while($i++<10 && print $i); // 12345678910
if(echo $i=1); // Parse error: syntax error, unexpected 'echo'
if(print $i=1); // 1
switch(echo $i=1){} // Parse error: syntax error, unexpected 'echo'
switch(print $i=1){} // 1
switch($i=1){
case echo $i; // Parse error: syntax error, unexpected 'echo'
}
switch($i=1){
case print $i; // 1
}
$i = echo 1 ? true : false; // Parse error: syntax error, unexpected 'echo'
$i = print 1 ? true : false; // 1
echo 1 ? true : false; // 1 代入しなければ動く
$i = echo 1 <=> 1; // Parse error: syntax error, unexpected 'echo'
$i = print 1 <=> 1; // 1
なぜなのか。