- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Environmental Science
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- articles and Answers
- Effective Resume Writing
- HR Interview articles
- Computer Glossary
- Who is Who
What does ‘<?=’ short open tag mean in PHP ?
The <?php is used to identify the start of a PHP document.
In PHP whenever it reads a PHP document, It looks for:
<?php ?>
It process the codes in between the above tags only and leaves the other codes around them.
For example :
<?php
echo "Hello PHP !";
?>
Output :
Hello PHP !
Note : But a special case is when you write a PHP file the end tag can be omitted, Only the start tag is needed.
The below code works fine as well:
<?php
echo "Hello PHP !";
Output:
Hello PHP !
The <= tag is called short open tag in PHP. To use the short tags, one must have to enable it from settings in the PHP.ini file.
First of all ensure that short tags are not disabled, To check it, go into php.ini file On line 77 .
(location in linux systems :/etc/php5/apache2/php.ini)
Find the below line in the file and add (On) instead of (Off):
short_open_tag=On
However, from PHP version 5.4.0, the short tags are available for use regardless of the settings in the PHP.ini file.
The below two examples produces the same output with and without short open tags.
Example 1 : Normal Way.
<?php
$username = "Codegyan";
echo "$username";
?>
Output:
Codegyan
Example 2 : The Short Hand Way.
<?php
$username = "Codegyan";
?>
<?= $username ?>
Output:
Codegyan
As you can observe, both of the above codes gives us the same output. So, using short tags we told to php interpreter that:
<? ?> can be treated same as <?php ?>
The above example can be further modified as follows :
<?=
$username = "Codegyan";
?>
Output:
Codegyan
- Related Questions & Answers
- How to Send Realtime Notifications if User Follow using PHP & Mysql
- Convert png, jpg, jpeg, gif to webp using PHP Function
- Write PHP Program To Print Sum Of Digits
- How to Prevent SQL Injection step by step in PHP?
- How can we create recursive functions in Python?
- Create Function to Insert Post and Update Post in Single Function using PHP
- Write Steps to create a functional and secure API using PHP
- See (stage) your website before switching your DNS
- What is the difference between echo, print, and print_r in PHP?
- What are Python function attributes?
- How to Store Array Data To Database to a Single Column Without serialize() & json_encode() Function
- PHP क्या है (What is PHP in Hindi)? पुरी जानकारी in Hindi
- What does ‘<?=’ short open tag mean in PHP ?
- How to Implementing User Verification Badge System using PHP
- How to Install PHP 8 on Ubuntu 20.04
- How to Get Current Page URL using PHP ?
ads