iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

PHP Intro

PHP is a server-side scripting language designed for the web. A request hits your server, PHP runs, the browser receives HTML.

Where PHP fits

Use caseExamples
Web frameworksLaravel, Symfony, CodeIgniter, Slim
CMS & e-commerceWordPress, Drupal, Magento, Joomla
Command-line scriptsphp script.php works fine
APIs & microservicesFastRoute, OpenSwoole, ReactPHP

How a PHP request works

  1. Browser asks for /page.php.
  2. Apache / Nginx routes the request to PHP.
  3. PHP executes the file, building HTML as it goes.
  4. The HTML — never the PHP source — goes back to the browser.

The PHP you're learning

This tutorial targets PHP 8.x. Modern features include:

  • Strict typing — typed properties, typed parameters, return types.
  • Constructor property promotion — public function __construct(public string $name) {}.
  • match expressions and structural enums.
  • Named arguments — greet(name: 'Ada').
  • Readonly properties (8.1+), readonly classes (8.2+).
  • First-class callable syntax — $fn = strtoupper(...);.
Tip: PHP 7 hit end-of-life in 2022; PHP 5 was retired in 2018. If a tutorial uses mysql_query or ereg, it's from another era — skip it.

Example

Example
<?php
// PHP runs on the server, before HTML reaches the browser.
echo 'Hello from PHP ' . PHP_VERSION;
Try it Yourself »

Exercise

PHP runs primarily on the…

Test yourself

Q1. PHP runs primarily…
Q2. Latest stable major series for new projects in 2026 is…
Q3. WordPress, Drupal, and Laravel are…

Discussion

Loading…