Syntax


Syntax:
"In linguistics, syntax (from Ancient Greek σύνταξις "arrangement" from σύν syn, "together", and τάξις táxis, "an ordering") is the study of the principles and rules for constructing phrases and sentences in natural languages."

-Wikipedia

What a syntax is:
A syntax is the opening and closing of code. We can't write PHP like we do with HTML or an article, so we enclose it with a particular tag, and that allows the server ti recognize what is PHP, and what isn't.

We open a section of PHP code with:

<?php
?>

or shorthand, if your server has it enabled

<? 
?>


Remember: PHP Has to be in a .php file in order for the server to read it properly.

Next we'll make your first official page; Hello world.

Diskutera uppgift


  • Mekesia   15 februari 2013 23:51

    There is also the alternative shorthand opening tag <?= 

     

    This is the equivalent of writing <?php echo = 

     

    In other words, all three of these statements are the same: 

    <?php echo $user; ?>

    <?= $user ?>

    <? echo $user; ?>