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