Introduction to PHP

      No Comments on Introduction to PHP

PHP (recursive acronym for : Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

An introductory example
<html>
<head>
</head>
<body>
<?php
echo "My first php script";
?>
</body>
</html>

OUTPUT:

My first php script

What is PHP?

  • It is a widely-used, open source scripting language
  • It scripts are executed on the server
  • It is free to download and use

Basic Syntax

A script can be placed anywhere in the document.A script starts with :

<?php
// PHP code goes here
?> 

Creating and declaring variables

In PHP, a variable starts with the $ sign, followed by the name of the variable:

<?php 
$x=10; //variable
$txt="Hellow world";
?>

More about PHP:

  • A PHP file can contain text,HTML,css,JavaScript. It runs over a server and returns the results to a browser in plain HTML.
  • It can generate dynamic page content and can create, open, read, write, delete, and close files on the server.It can collect form data.It can send and receive cookies
  • Can add, delete, modify data in your database. It can be used to control user-access
    and it can also encrypt data

Why PHP?

  1. Fast and easy to learn and use
  2. Can run on many platforms, including Windows, Linux and Mac, it’s easy for users to find hosting service providers.It is compatible with all servers like (Apache, IIS, etc.)
  3. It supports a wide range of databases
  4. Open source. Download it from the official  resource: www.php.net.
    Licensing
    PHP is free software released under the License, which stipulates that: Products derived from this software may not be called “PHP”, nor may it appear in their name, without prior written permission from group@php.net.This restriction on use of it makes the¬† License incompatible with the General Public License (GPL), while the Zend License is incompatible due to an advertising clause similar to that of the original BSD license.
php-mascot

PHP Mascot

Leave a Reply

Your email address will not be published. Required fields are marked *