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:


Getting started:
* PHP Tags

Table Of Contents
0 Getting started
2 Arrays
4 Types
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
102 APCu
108 PSR