I've found some page where people print strings on the web page with this:
<?= 'hello world'; ?>
Is this a faster way to print
strings in one row of code or does it work different?
I've found some page where people print strings on the web page with this:
<?= 'hello world'; ?>
Is this a faster way to print
strings in one row of code or does it work different?
Yes. This would work as echo, but it IS NOT RECOMMENDED and many servers have got this availability disabled. It's called "short tag"
According to the documentation, the <?= ... ?>
form is a shortcut for echo
, so they should be the same from a performance perspective.
It's not exactly the same as just echo
, it's a shortcut syntax.
<?= 'hello world'; ?>
would be the same as:
<?php echo 'hello world'; ?>
The latter is recommended because short_open_tags
might be disabled on your server.