PHP facts for kids
![]() |
|
Paradigm | imperative, object-oriented, Procedural, reflective |
---|---|
Designed by | Rasmus Lerdorf |
Developer | The PHP Group |
First appeared | 1995 |
Stable release |
7.3.6 / May 30, 2019
|
Typing discipline | Dynamic, weak |
Implementation language | C |
OS | Cross-platform |
License | PHP License |
Filename extensions | .php , .phtml , .php4 , .php3 , .php5 , .php7 , .phps , .php-s , .phar |
Major implementations | |
Zend Engine, Phalanger, Quercus, Project Zero, HHVM | |
Influenced by | |
C, C++, Java, Perl, Tcl | |
Influenced | |
Hack | |
|
PHP (which stands for PHP: Hypertext Preprocessor) is a special computer language. It helps people create websites that are more exciting and useful. Think of it like a brain for your website!
When you visit a website, PHP code runs on a special computer called a web server. This server then sends the finished web page to your computer. This way, websites can do cool things like let you log in with a password or show you personalized information.
Websites made with PHP can have pages that are protected by a password. Without programming, a website cannot do this easily. Common file types for PHP pages are .php, .php3, or .phtml. However, a web server can be set up to use almost any file extension.
PHP's design was inspired by other computer languages. These include C, Perl, Java, C++, and even Python. PHP is also considered to be free software. This means it can be used, changed, and shared by anyone.
History of PHP
PHP was first created by a person named Rasmus Lerdorf. He made it in the year 1995. At first, PHP stood for Personal Home Page.
Over time, many people started working on PHP. A large team now helps to develop and improve it. The name was later changed to PHP: Hypertext Preprocessor. This new name cleverly uses the old PHP letters.
How PHP Works: An Example
PHP code is often put inside a HTML document. HTML is the language used to build the basic structure of web pages. PHP adds the interactive parts.
Here is a simple example. This code would make a web page say "Hello, World!":
<?php
echo "Hello, World!";
?>
This small piece of code tells the web server to display the words "Hello, World!" on the page.
Here is another example. This shows how PHP can be used within an HTML page:
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<?= '<p>Hello World</p>'; ?>
</body>
</html>
In this example, the PHP code `<?= '
Hello World
'; ?>` is placed right inside the HTML. When the web server processes this page, it runs the PHP part. Then, it sends the complete HTML, including "Hello World" inside a paragraph, to your web browser.
Images for kids
-
This is an example of PHP code for the WordPress content management system.