PHP tagged <?= <?php

Source: Internet
Author: User

PHP officially supports the following naming: <?php <?= <? <script language= "PHP" >, the most common use is combined with HTML to achieve the role of analytic data.

Recommended notation is the first: <?php?>

The second is <?=?> equivalent to <?php echo?> for example:

<?= "Hello World"?> equivalent to <?php echo "Hello World"?>

Before PHP 5.4 php.ini , the instructions in the configuration file must be opened before Short_open_tag is available. But after 5.4, you can use it at will.

The third kind of <? echo "Hello World"?>

This form is not parsed in HTML and will be interpreted as a comment

Fourth type <script language= "PHP" > echo "Hello World" </script>

This form is available before PHP7.0 and is not parsed.

--------------------------------------------------------------------------------------------------------------- -----------

PHP separate notation

If statement:

<?php if ($expression = = true):?>  If so <?php else:?>  is like that <?php endif;?>

also equivalent to

<?php if ($expression = = True) {?>  if so <?php} else{?>  No is that <?php}?>

foreach Loop:

<table>    <tr>        <th>id</th>        <th> name </th>        <th> class </th >        <th> Admission time </th>    </tr>    <?php foreach ($items as $item) {?>        <tr>            <td><?= $item [' id '];?></td>            <td><?= $item [' name ']?></td>            < td><?= $item [' class ']?></td>            <td><?= $item [' join_time ']?></td>        </ Tr>    <?php}?></table>

It is extremely important to traverse the build list! and Jstl label likeness.

Complete!

PHP tagged <?= <?php

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.