Skip to content
Learn Netverks

Lesson

Step 1/36 3% through track

intro

Introduction to PHP

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~3 min
Level
beginner

This lesson

An orientation to the PHP track—how the server playground works, core vocabulary, and what you will practice next.

You need a clear map of the PHP track so HTTP, requests, and server execution do not feel like magic.

You will apply Introduction to PHP in contexts like: LAMP/LEMP stacks, Laravel apps, WordPress themes/plugins, and shared hosting.

Write PHP in the editor and click Run on server—the dev runner executes your script and returns stdout/stderr (set LEARNING_RUNNER_ENABLED=true locally). Also read the interview prep blocks.

After HTML fundamentals and basic programming concepts—before or alongside SQL.

How this PHP track works

  • Server PHP in the playground — your code runs on the dev runner with echo, print_r, and var_dump for output. Click Run to execute.
  • Web concepts in prose$_GET, $_POST, sessions, and PDO are taught with sample arrays and comments when real HTTP or a database is not available in the runner.
  • Prerequisites — finish HTML (forms, semantic markup) and JavaScript (functions, objects, async basics) before this track.

Use echo for strings, print_r() for arrays, and var_dump() when you need types and structure.

Install on your device (macOS, Linux, Windows)

Install PHP 8.2+ for local Laravel/WordPress practice; lesson playground runs PHP via the dev runner.

macOS

  1. brew install php
  2. Optional full stack: Laravel Herd or brew install mysql for databases.

Linux

  1. Debian/Ubuntu: sudo apt update && sudo apt install -y php-cli php-mbstring php-xml php-curl unzip
  2. Fedora: sudo dnf install -y php php-cli php-mbstring php-xml

Windows

  1. winget install PHP.PHP.8.3 or use XAMPP / Laravel Herd for Windows.
  2. Add PHP to PATH if the installer does not (Settings → Environment Variables).

Verify: php -v shows PHP 8.2 or newer.

Run code on this site (Backend & language playgrounds)

  1. Clone or open this project locally; copy .env.example to .env.
  2. Ensure LEARNING_RUNNER_ENABLED=true and LEARNING_RUNNER_URL=http://127.0.0.1:9999/v1/execute.
  3. Terminal 1: php artisan serve (or composer run dev for Laravel + Vite + runner together).
  4. Terminal 2: npm run runner — keep it running while you click Run on server.

PHP (PHP: Hypertext Preprocessor) is a server-side scripting language built for the web. Your browser requests a URL; a web server runs PHP code, often talks to a database, and returns HTML (or JSON) as the response.

How this track differs from JavaScript in the browser

After the JavaScript track, you know variables, functions, and DOM events that run in the user's browser. PHP runs on the server before the response is sent. You use it for form handling, authentication, database queries, and generating dynamic pages.

The HTML track taught document structure and forms. PHP often produces that HTML—or fills templates with data from a database.

What you will learn

  • PHP syntax: tags, variables, control flow, functions, and OOP basics
  • Arrays, JSON, and superglobals like $_GET and $_POST
  • Sessions, cookies, includes, and error handling for web apps
  • PDO for safe database access and security fundamentals
  • Composer, autoloading, and production habits

Playground setup

This topic uses the server_script profile: PHP executes on the dev runner when you click Run. Output appears in the terminal via echo, print_r, and var_dump. Web-only features (real HTTP requests, live sessions, MySQL) are simulated with sample arrays and comments—real projects need a local stack (PHP + web server + database).

Self-check

  1. In one sentence, where does PHP run compared to browser JavaScript?
  2. Why do we recommend HTML and JavaScript before this track?

Interview prep

What is PHP in one sentence?

A server-side scripting language that generates HTTP responses—often HTML or JSON—after the web server receives a request, running before anything reaches the browser.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Why PHP after HTML/JS?
  • Where would you deploy first?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump