DEV Community

mrwaccaff
mrwaccaff

Posted on

How to display a value in html with php without using the echo keyowrd using the short echo tag

I have been coding with php since 2015, I have always been curious to know how to output values on the webpage without using templates like twig or Laravel blade Template engine. I got my answer recently which is this tag that was disabled in earlier versions of php but made available from php 5.4 and above.
This code
<?php echo $name; ?>
is the same thing as this
<?= $name ?>
This makes the code shorter and more readable.
You can make changes to this in your php.ini using
; short_open_tag
; Default Value: On
Default value can either be on or off.
It is enabled by default on Shared hosting services, so you don't have to worry about compatibility.
I hope you find this helpful check back again for my posts

Top comments (0)