PHP, aka Personal Home Page, is an actively used programming language created in 1995.

24Years Old 3,130,179Users 26,354Jobs

Example code from the Hello World Collection:

<?php
  // Hello world in PHP
  echo 'Hello World!';
?>

Example code from Linguist:

#!/usr/bin/php
<?php

echo "PHP\n";

Example code from Wikipedia:

class Person
{
    public $firstName;
    public $lastName;

    public function __construct(string $firstName, string $lastName = '') { // optional second argument
        $this->firstName = $firstName;
        $this->lastName  = $lastName;
    }

    public function greet(): string {
        return 'Hello, my name is ' . $this->firstName .
               (($this->lastName != '') ? (' ' . $this->lastName) : '') . '.';
    }

    public static function staticGreet(string $firstName, string $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."
Edit

Last updated February 11th, 2019