PHP and MySQL Basics: Syntax
Posted by Daniel at 5:37 pm
PHP syntax is very simple it has 3 main parts, the first part is the php opening tag which is <?php, after that is your PHP CODE then the last part is the php closing tag which is ?>
it looks like this..
<?php . . . . . . . . . . . . . . . . . . . . . . YOUR PHP CODE HERE . . . . . . . . . . . . . . . . . . . . . . ?>
you can also use the PHP Short open tags:
<? ?> <?= ?>
but this is considered a bad habit.. you can use this tags but be sure that short open tag is set to on in your PHP.INI file.
there is another tag style which is the ASP Style Tag:
<% %> <%= >
this is considered as a very bad habit.. because it doesn’t always work, for example your friend send you a php file using this style and you run it on your server, but suddenly your server doesn’t allow the use of this tags, of course the code wont work!
you can use these style but you also need to enable them in the PHP.INI file..