note 125354 added to language.basic-syntax.phptags
| From: | anisgazig at gmail dot com | Date: | Sat, 12 Sep 2020 04:10:27 +0000 |
| Subject: | note 125354 added to language.basic-syntax.phptags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215103@lists.php.net to get a copy of this message | ||
When php parse a file,it looks for opening and closing tag.php parser interpreting the code between
opening and closing tag and allows php to be embedded in all shorts of different documents.Outside
of opening and closing tag is ignored by the php parser.
Now php recommended you to use only two tags.
1.Standard tag which is <?php echo "I'm Standard tag"; ?>
2.Short echo tag which is <?= "I'm Short echo tag"; ?>
Both are not affected by php ini configuration file directive.
Although php also allow short open tag which is discoursed but still available if php was configured
with --enable-short-tags or short_open_tag is enabled in php ini configuration file directive.
if you want to use php in combination with xml,you can disable short_open_tag in order to use
<?xml ?> inline.
Otherwise, you can print it with PHP, for example: <?php echo '<?xml
version="1.0"?>'; ?>
short_echo_tag also affected the short echo tag before 5.4.0
since 5.4.0,short echo tag is always available.
asp tag <% %> and <%= > are removed from php 7
script tag <script language="php"> <script/> also removed from php 7
It is preferable to omit the closing tag if a file only contain the php code.
<?php echo "a statement";
echo "another statement";
It prevent unwanted whitespace or new line being added after the closing tag.
--happy-gazi|php-
----
Server IP: 45.112.84.4
Probable Submitter: 103.51.167.36 (proxied: 103.19.255.153)
----
Manual Page -- http://php.net/manual/en/language.basic-syntax.phptags.php
Edit -- https://master.php.net/note/edit/125354
Del: integrated -- https://master.php.net/note/delete/125354/integrated
Del: useless -- https://master.php.net/note/delete/125354/useless
Del: bad code -- https://master.php.net/note/delete/125354/bad+code
Del: spam -- https://master.php.net/note/delete/125354/spam
Del: non-english -- https://master.php.net/note/delete/125354/non-english
Del: in docs -- https://master.php.net/note/delete/125354/in+docs
Del: other reasons-- https://master.php.net/note/delete/125354
Reject -- https://master.php.net/note/reject/125354
Search -- https://master.php.net/manage/user-notes.php