PHP Basics

PHP Tags

  • <?php …… ?> 
  • <? ……. ?>
  • <?=$variable ?>
  • <script language=”php”> ……. </script>
  • <% …… %>

Anotomy of a PHP script

<?php

            echo "Hello World";

?>

Comments 

// Single line comment 
# Single line comment   
 
/* Multi-line 
comment 
*/   
 
/** 
* API Documentation Example 
* 
* @param string $bar 
*/ 
function foo($bar) { }

Single line comments are terminated by

  • \r\n    or    \n\r
  • ?>

Language Constructs (elements that are built in to the language)

  • echo 123;
  • die();
  • exit();

Leave a Reply

You must be logged in to post a comment.