As a contribution, I would like to answer your question quoting the indications of the PHP Manual, leaving the links for reference.
<?= ?>
According to the Manual it is an abbreviation that is equivalent to <? echo ?>.
... the abbreviation <?=... which is the same as <? echo. Before PHP 5.4.0 the use of this shorthand required it to short_open_tag
be enabled. Since PHP 5.4.0, <?=it is always available.
<?php ?>
They are the opening and closing tags used to interpret PHP code.
From what is indicated in the Manual , it is important to underline the following:
These tags offer the possibility of embedding PHP code in all types of documents.
If we are writing a file that only contains php code, it is convenient to omit the closing tag?>
The shorthand opening tag is allowed <?, but its use is discouraged
When PHP parses a file, it looks for the opening and closing tags, which are <?phpand ?>, which tell PHP where to start and stop interpreting the code. This mechanism allows PHP to be embedded in all kinds of documents , since everything outside the opening and closing PHP tags will be ignored by the parser.
PHP also allows the shortened opening tag <?(which is deprecated since it is only available if enabled with the short_open_tagconfig file directive php.ini, or if PHP was configured with the option
--enable-short-tags).
If a file contains only PHP code, it is preferable to omit the closing PHP tag at the end of the file . This prevents accidental whitespace or newlines from being added after the closing tag, which would cause undesirable effects because PHP will start outputting from the buffer when there was no intention on the part of the programmer to send any output at that point. of the script.
<?= ... ?>It is the abbreviation for <?php echo?>.
<?php ... ?>It is the verbose way of entering php code.
<? ... ?>It is the short form of <?php ... ?>.
It is better to use the second whenever possible as the first and third may not be available
You can see if the short form is enabled or not in the file php.ini, by the short_open_tag. Although as of PHP 5.4.0 the directive <?= ... ?>is always available.
It is the equivalent of doing
, then do
It is the equivalent of doing
Secondly
It is the standard way to open php tags. There is a shorthand using
But as already mentioned, they depend on parameters in the php configuration and are not always available.
As a contribution, I would like to answer your question quoting the indications of the PHP Manual, leaving the links for reference.
<?= ?>
According to the Manual it is an abbreviation that is equivalent to
<? echo ?>
.<?php ?>
They are the opening and closing tags used to interpret PHP code.
From what is indicated in the Manual , it is important to underline the following:
?>
<?
, but its use is discouragedIn php the symbols
<?= $variable ?>
indicate an abbreviation of<?php echo variable; ?>
This feature is enabled by default since version 5.4
<?= ... ?>
It is the abbreviation for<?php echo?>
.<?php ... ?>
It is the verbose way of entering php code.<? ... ?>
It is the short form of<?php ... ?>
.It is better to use the second whenever possible as the first and third may not be available
You can see if the short form is enabled or not in the file
php.ini
, by theshort_open_tag
. Although as of PHP 5.4.0 the directive<?= ... ?>
is always available.