Introduction
PHP
PHP is a server-side scripting language like ASP and JSP that can do all sorts of things: evaluate form data sent from a browser, build custom web content to serve the browser, talk to a database, and even send and receive cookies. Basically PHP designed for web development but also used as a general-purpose programming language. PHP scripts are executed on the server. PHP supports many databases like- MySql, Oracle, Sybase, Solid, PostgreSql, Generic ODBC... etc. PHP is open source software. PHP is free to download and use.
PHP File
Why PHP
Where to Start
To start with PHP, you can:-
PHP Setup
Your First PHP Program
PHP code is embedded in HTML using <?php ... ?> tags. The server processes the PHP and sends plain HTML to the browser.
<?php
// Single-line comment
/* Multi-line comment */
// Variables start with $
$name = "Tutorials Logic";
$version = 8.2;
$isActive = true;
// Output
echo "Hello, World!<br>";
echo "Welcome to $name<br>";
// String interpolation
echo "PHP version: {$version}<br>";
// print_r for arrays/objects
$languages = ["PHP", "JavaScript", "Python"];
print_r($languages);
// var_dump shows type + value
var_dump($isActive); // bool(true)
?>
PHP Versions - Key Milestones
| Version | Year | Key Features |
|---|---|---|
| PHP 5.6 | 2014 | Variadic functions, constant expressions |
| PHP 7.0 | 2015 | 2x faster, scalar type hints, null coalescing ?? |
| PHP 7.4 | 2019 | Typed properties, arrow functions, spread operator |
| PHP 8.0 | 2020 | JIT compiler, named arguments, match expression, union types |
| PHP 8.1 | 2021 | Enums, fibers, readonly properties, intersection types |
| PHP 8.2 | 2022 | Readonly classes, DNF types, deprecated dynamic properties |
| PHP 8.3 | 2023 | Typed class constants, json_validate(), deep cloning |
Key Takeaways
- PHP is a server-side language - code runs on the server and sends HTML to the browser.
- PHP files use the .php extension and can mix HTML and PHP code.
- Variables in PHP start with a $ sign and are dynamically typed.
- PHP 8.x introduced major performance improvements via the JIT compiler - always use PHP 8+ for new projects.
- PHP powers over 75% of websites with a known server-side language, including WordPress, Laravel, and Drupal.
- Use echo or print to output content; var_dump() and print_r() for debugging.
Related PHP Topics
Ready to Level Up Your Skills?
Explore 500+ free tutorials across 20+ languages and frameworks.