Usage of <?= ?> tag

Usage of <?=  ?> tag

Usage of <?= ?> tag

In PHP, to print a values of a variable we use echo and print statements.
Instead of that to display a php variables directly in the html page by using this tag. This is the another way of print statement.

Syntax:
<?= (expression or variables) ?>

here, The output is displayed directly to the browser.

Exampe:

<?php
$str = “Good Morning”;
?>

<h1>hello <?=$str?></h1>

The above code displays Hello Good Morning
in H1 format in browser.

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.