Internet – PHP

PHP is a popular server-side scripting language that is used to make dynamic and interactive web pages.  Unlike Javascript code, which is executed by the browser, PHP scripts are executed on the server.  The result is returned to the browser as HTML.  PHP is free and open-source.  It runs on various platforms and is compatible with almost all servers used today.  Some of the key features of PHP follow.  For more information, consult PHP resources such as www.w3schools.com/PHP/default.asp.

Here are some of the fundamentals that you need to know about PHP.

  • PHP scripts start with <?php  and end with ?>, e.g.,
    <?php
    echo “Hello world!”;     //echo is used to output one or more strings
    ?>
  • PHP scripts may be inserted anywhere in an HTML document.
  • You can also put PHP in an external file.  PHP files have a .php extension.  You can load an external PHP file named sample.php using this expression:
    <?php include ‘sample.php’; ?>
  • Each PHP statement ends with a semicolon (;).  Multiple statements can be grouped together in blocks using curly brackets({ }).
  • PHP is NOT case sensitive for user-defined function, classes, and keywords.  However, variable names are case-sensitive  This means a variable named totalScore is different from a variable named TotalScore.

Introduction Video Video Length: 5:17
The following video demonstrates an example of a web page with a simple form that collects the user’s name and e-mail address. When submitted, this form is sent to the PHP file below, which displays back the input information.Click here to download the source code

Details about PHP