Questions Columns Rows
GitHub icon

PHP

PHP - Programming language

< >

PHP, aka Personal Home Page, is a programming language created in 1995 by Rasmus Lerdorf.

Source code:
git clone https://github.com/php/php-src
#9on PLDB 28Years Old 3mRepos

Try now: RijuTIOReplit

PHP is a server-side scripting language designed primarily for web development but also used as a general-purpose programming language. Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Development Team. PHP originally stood for Personal Home Page, but it now stands for the recursive acronym PHP: Hypertext Preprocessor. Read more on Wikipedia...


Example from Riju:
<?php echo "Hello, world!\n";
Example from hello-world:
<?php echo 'Hello World';
<?php // Hello world in PHP echo 'Hello World!'; ?>
Example from Linguist:
#!/usr/bin/php <?php echo "PHP\n";
Example 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."
__CLASS__ __DIR__ __FILE__ __FUNCTION__ __halt_compiler() __LINE__ __METHOD__ __NAMESPACE__ __TRAIT__ abstract and array() as break callable case catch class clone const continue declare default die() do echo else elseif empty() enddeclare endfor endforeach endif endswitch endwhile eval() exit() extends final finally for foreach function global goto if implements include include_once instanceof insteadof interface isset() list() namespace new or print private protected public require require_once return static switch throw trait try unset() use var while xor yield

View source

- Build the next great programming language Search Add Language Features Creators Resources About Blog Acknowledgements Stats Sponsor Traffic Traffic Today Day 267 feedback@pldb.com Logout