Thursday, August 6, 2009

PHP Syntax


Bookmark and Share




  • simple and easy to understand.

  • derived from many languages but most of it were from C and some from Perl.

  • its object-oriented syntax were patterned from Java and C++.


Source Files and PHP Tags


PHP code can be inserted directly into a text file using a special set of tags; the interpreter will then output any text outside the tags as-is, and execute the code that is between the tags.



4 Types of Tags



  1. Standard Tags

    <?php
    ... code
    ?>


  2. Short Tags

    <?
    ... code
    ?>
    <?= $variable ?>


  3. Script Tags

    <script language="php">
    ... code
    </script>


  4. ASP Tags

    <%
    ... code
    %>



Note:

3 and 4 are all considered deprecated.

Note:

To prevent spurious output from an include file, omit the closing tag at the end

Bookmark and Share

No comments:

Post a Comment