Is there any particular reason to use one over the other? I personally tend to use the latter, as it just seems to flow better to me.
They do the same thing, the <?= is just called the short tag and is shorthand for <?php echo. You have to make sure the short tags are enabled to use the <?= notation.
As far as I know, they are functionally equivalent except the second can be disabled in configurations so isn't as portable.
short_open_tag
booleanTells whether the short form ( ) of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use inline. Otherwise, you can print it with PHP, for example: . Also if disabled, you must use the long form of the PHP open tag ( ).
Note: This directive also affects the shorthand
Source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With