PHP Tags

suggest change

There are three kinds of tags to denote PHP blocks in a file. The PHP parser is looking for the opening and (if present) closing tags to delimit the code to interpret.

Standard Tags

These tags are the standard method to embed PHP code in a file.

<?php
    echo "Hello World";
?>

Echo Tags

These tags are available in all PHP versions, and since PHP 5.4 are always enabled. In previous versions, echo tags could only be enabled in conjunction with short tags.

<?= "Hello World" ?>

Short Tags

You can disable or enable these tags with the option short_open_tag.

<?
    echo "Hello World";
?>

Short tags:

ASP Tags

By enabling the asp_tags option, ASP-style tags can be used.

<%
    echo "Hello World";
%>

These are an historic quirk and should never be used. They were removed in PHP 7.0.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents