Skip to main content

PHP

PHP: Hypertext Preprocessor

Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/php

In short

PHP is a dynamically typed scripting language designed for web development that runs on the server to generate HTML pages and respond to browser requests.

What is PHP?

PHP is a scripting language for web development created by Rasmus Lerdorf in 1994, originally as a set of tools for his personal home page. Today the name is a recursive acronym for "PHP: Hypertext Preprocessor." PHP runs on the server: when a browser requests a page, the web server passes the request to PHP, which runs the script and sends back the resulting HTML or JSON. PHP code can even be embedded directly inside HTML between <?php and ?> tags.

PHP is dynamically typed, but modern versions support type declarations for function parameters, return values, and class properties, and declare(strict_types=1) turns off automatic type conversion for those checks. Memory is managed automatically with reference counting and a cycle collector. In the traditional model, each request starts with a clean slate and all its memory is released when the response is sent, which keeps applications simple to reason about and to scale.

PHP powers a large share of websites, including many content management systems, blogs, online stores, and web APIs, and it is usually paired with a SQL database. PHP works like a restaurant kitchen: the customer (the browser) receives only the finished dish (the HTML), never the recipe (the PHP code). Recent releases, starting with PHP 8, added a JIT compiler, union types, enums, match expressions, and readonly properties.

PHP is sometimes confused with JavaScript because both are closely tied to the web. PHP runs on the server and the browser never sees its code, while JavaScript mostly runs in the browser to make pages interactive, although it can also run on servers. Older PHP versions were criticized for inconsistent functions and loose type juggling, but versions 7 and 8 brought major speed improvements and much stricter typing options.

Key takeaways

  • PHP runs on the server and sends only its output, such as HTML or JSON, to the browser.
  • It is dynamically typed, with optional type declarations and a strict types mode.
  • Memory is managed automatically and released at the end of each request.
  • It powers a large share of websites, including many content management systems.
  • Modern PHP 8 adds features like enums, match expressions, and a JIT compiler.

Example

A typed function that greets a visitorphp
<?php
declare(strict_types=1);

// Type declarations reject wrong argument types when called
function greet(string $name, int $visits): string
{
    return "Hello, {$name}! This is visit number {$visits}.";
}

$name = htmlspecialchars($_GET['name'] ?? 'guest'); // Escape user input
echo greet($name, 3);

Readers ask

Is PHP still used?

Yes. PHP still runs a large share of the web, especially sites built on popular content management systems, and the language gets a new release every year with new features and performance improvements.

What does PHP stand for?

PHP originally stood for Personal Home Page. Today it is a recursive acronym for PHP: Hypertext Preprocessor, where the first letter refers back to the name itself.

What is the difference between PHP and JavaScript?

PHP runs on the server and sends the finished result to the browser, while JavaScript mainly runs inside the browser to make pages interactive. JavaScript can also run on servers with runtimes such as Node.js.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings