– image courtesy wiki

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP is now installed on more than 244 million websites and 2.1 million web servers. Originally created by Rasmus Lerdorf in 1995, the implementation of PHP is now produced by The PHP Group. While PHP originally stood for Personal Home Page, it now stands for PHP: Hypertext Preprocessor, a recursive acronym.

PHP code is interpreted by a web server with a PHP processor module, which generates the resulting web page: PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data. It has also evolved to include a command-line interfacecapability and can be used in standalone graphical applications.

File:LAMP software bundle.svg


PHP is free software released under the PHP License, which is incompatible with the GNU General Public License (GPL) due to restrictions on the usage of the term PHP. PHP can be deployed on most web servers and also as a standalone shell on almost every operating system and platform, free of charge.

A simple syntax:

<!DOCTYPE html>
<meta charset="utf-8">
<title>PHP Test</title>
 echo 'Hello World';

A method or function:

function myFunction()  // defines a function, this one is named "myFunction"
    return 'John Doe'; // returns the value 'John Doe'

echo 'My name is ' . myFunction() . '!'; //outputs the text concatenated with the return value of myFunction.

// myFunction() is called as the result of this syntax.
// The result of the output will be 'My name is John Doe!'

..more functions.

function getAdder($x)
    return function($y) use ($x)
               return $x + $y;

//$adder = getAdder(8);
//echo $adder(2); // prints "10"

function lock()
    $file = fopen('file.txt', 'r+');

    if (!flock($file, LOCK_EX | LOCK_NB))
        goto retry;

    fwrite($file, 'Success!');

php classes

class Person {
 public $firstName;
 public $lastName;

 public function __construct($firstName, $lastName = '') { //Optional parameter
  $this->firstName = $firstName;
  $this->lastName = $lastName;

 public function greet() {
  return "Hello, my name is " . $this->firstName . " " . $this->lastName . ".";

 public static function staticGreet($firstName, $lastName) {
  return "Hello, my name is " . $firstName . " " . $lastName . ".";

$he = new Person('John', 'Smith');
$she = new Person('Sally', 'Davis');
$other = new Person('iAmine');

echo $he->greet(); // prints "Hello, my name is John Smith."
echo '<br />';
echo $she->greet(); // prints "Hello, my name is Sally Davis."
echo '<br />';
echo $other->greet(); // prints "Hello, my name is iAmine ."
echo '<br />';
echo Person::staticGreet('Jane', 'Doe'); // prints "Hello, my name is Jane Doe."


One thought on “PHP/MYSQL

  1. No matter whether you might be a brand-new comer to be able to profit via the internet or have been popular some time,Burberry Watch, PLR are something you require to make a look at.

Leave a Reply

Your email address will not be published.