The echo command is documented with a function prototype that looks like this:
echo ( string arg1 [, string argn...])
don't the parentheses signify a string well enough? For instance, supposing one wants interpolation, why should one have to use
echo ("<a href=\"$foo\">$bar</a>");
or:
echo ('<a href="' . $foo . '">' . $bar . '</a>');
or:
echo <<<END <a href="$foo">$bar</a> END;
when
echo (<a href="$foo">$bar</a>);
is so much cleaner? Everything between the parentheses is clearly a string, and should be interpolated. Strings between parentheses should work like a heredoc. Using quotes to signify interpolation is a bad choice for a language built to make Web documents, which [should] use quotes for attribute values.
Right... need to be able to evaluate expressions...
echo ($foo * $bar);
Which do you use more when using echo -- string interpolation or expression evaluation?
I concede that the above is a pointless argument as really string interpolation like what you see above doesn't actually belong in a script. It should be in a template instead. I use PHP from time to time, and I don't find it difficult to use at all. But this is one thing that has always annoyed me.
Why is it that the echo command requires one to escape quotes if PHP is "built for the web?" That has always intrigued me as a fundamental usability flaw.
The echo command is documented with a function prototype that looks like this:
don't the parentheses signify a string well enough? For instance, supposing one wants interpolation, why should one have to useor:or:whenis so much cleaner? Everything between the parentheses is clearly a string, and should be interpolated. Strings between parentheses should work like a heredoc. Using quotes to signify interpolation is a bad choice for a language built to make Web documents, which [should] use quotes for attribute values.Right... need to be able to evaluate expressions...
Which do you use more when using echo -- string interpolation or expression evaluation?I concede that the above is a pointless argument as really string interpolation like what you see above doesn't actually belong in a script. It should be in a template instead. I use PHP from time to time, and I don't find it difficult to use at all. But this is one thing that has always annoyed me.
Just my $0.02
Why is it that the echo command requires one to escape quotes if PHP is "built for the web?" That has always intrigued me as a fundamental usability flaw.