PHP Fundamentals
PHP is a server-side scripting language designed for web development. It runs on a web server, processes requests, and produces HTML that a browser displays. Most of the web's content management systems and many large-scale applications use PHP as their primary language.
itProgramming languages | OpenSkills.info
Intro
PHP Fundamentals
PHP is a general-purpose scripting language built for web development. It runs on the server, receives HTTP requests, and returns HTML, JSON, or other output to a client. The name is a recursive acronym: PHP Hypertext Preprocessor.
Rasmus Lerdorf created the first version in 1994 as a set of CGI scripts for tracking visits to his personal homepage. The language grew through community contribution into a full programming language with object-oriented features, a type system, and a large standard library.
Why PHP exists
The web's request-response cycle is PHP's native environment. A web server receives a request, hands it to PHP, PHP executes a script, and the server sends the output back. This model means PHP scripts start fresh on each request — no long-running process to manage, no shared memory between requests unless you add explicit caching.
That simplicity made PHP the default choice for dynamic websites through the 2000s and 2010s. It remains the server-side language behind roughly 75 percent of websites whose technology is known, including WordPress, MediaWiki, and many enterprise applications.
What PHP does well
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.php.net/manual/en/introduction.php
Supports
- PHP as a server-side scripting language focused on web development
- Three areas of use (server-side, command-line, desktop)
- Shared-nothing request lifecycle
- PHP running on a web server producing output sent to the browser
- https://www.php.net/manual/en/history.php.php
Supports
- Creation by Rasmus Lerdorf in 1994
- Evolution from CGI scripts to a full programming language
- Community-driven development history
- https://www.php.net/manual/en/langref.php
Supports
- PHP syntax (semicolons, curly braces, dollar-sign variables)
- Control structures (if, for, foreach, while, match)
- Functions, closures, and arrow functions
- C, Java, and Perl syntax heritage
- https://www.php.net/manual/en/language.types.declarations.php
Supports
- Scalar type declarations introduced in PHP 7.0
- Return type declarations
- Union types (8.0), intersection types (8.1), DNF types (8.2)
- Nullable types and void/never return types
- Runtime enforcement of type declarations
- https://www.php.net/manual/en/language.variables.basics.php
Supports
- Dollar-sign prefix for all variables
- Case sensitivity of variable names
- Dynamic typing by default
- https://www.php.net/manual/en/language.oop5.php
Supports
- Classes, interfaces, traits, abstract classes
- Single inheritance, multiple interface implementation
- Visibility modifiers (public, protected, private)
- Constructor promotion, readonly properties
- https://www.php.net/manual/en/language.enumerations.php
Supports
- Enums added in PHP 8.1
- Backed enums with string or int values
- Type-safe fixed value sets
- Quiz answer about enums as the correct feature for fixed statuses
- https://www.php.net/manual/en/language.fibers.php
Supports
- Fibers added in PHP 8.1
- Cooperative multitasking within a single thread
- Suspend and resume execution model
- Not parallel or multi-threaded execution
- https://www.php.net/manual/en/book.pdo.php
Supports
- PDO as a database abstraction layer
- Prepared statements preventing SQL injection
- Support for MySQL, PostgreSQL, SQLite
- Error mode configuration
- https://www.php.net/manual/en/pdo.prepared-statements.php
Supports
- Prepared statements separating query structure from data
- SQL injection prevention mechanism
- Quiz answer about why prepared statements prevent injection
- https://www.php.net/manual/en/book.opcache.php
Supports
- OPcache storing compiled bytecode
- Elimination of repeated parsing and compilation
- Bundled with PHP since 5.5
- https://www.php.net/manual/en/features.connection-handling.php
Supports
- Script termination and resource cleanup at request end
- Shared-nothing request model
- https://www.php.net/releases/8.4/en.php
Supports
- PHP 8.4 released November 2024
- Property hooks and asymmetric visibility
- Updated DOM API and performance improvements
- https://getcomposer.org/doc/00-intro.md
Supports
- Composer as the standard PHP dependency manager
- Package resolution from Packagist
- Class autoloading generation
- Lock file for reproducible installs
- https://www.php-fig.org/psr/
Supports
- PSR-4 autoloading standard
- PSR-7 HTTP message interfaces
- PSR-12 coding style
- PSR-15 middleware
- Interoperability between PHP libraries and frameworks
- https://www.php-fig.org/psr/psr-4/
Supports
- Class-to-file mapping by namespace prefix
- Composer implementation of PSR-4
- Quiz answer about PSR-4 as the autoloading standard
- https://phpstan.org/user-guide/getting-started
Supports
- Static analysis finding type errors without execution
- Rule levels for progressive strictness
- Quiz answer about static analysis as the tool category for pre-runtime type checking
- https://psalm.dev/
Supports
- Alternative static analysis tool for PHP
- Type inference and error detection
- https://w3techs.com/technologies/details/pl-php
Supports
- PHP usage share among server-side languages (approximately 75 percent)
- WordPress market share (over 40 percent of all websites)
