PHP Programming
PHP and the Request Cycle
PHP runs on the server: a browser requests a page, PHP executes, and only the resulting HTML travels back. Understanding this cycle explains everything about server-side code.
Key Concepts
- PHP lives between tags, usually in .php files served by Apache/Nginx
- echo outputs text into the response; the browser never sees your PHP source
- Variables start with $: $name = 'Nepal'; types are dynamic
- String interpolation works in double quotes: "Hello $name"; concatenation uses the dot: 'Hello ' . $name
- Local testing: XAMPP/Laragon on Windows, or php -S localhost:8000 built-in server
Try It Yourself
Run php -S localhost:8000 (or XAMPP), create index.php that echoes 'Namaste' plus today's date with date(). View source in the browser — confirm no PHP is visible.
Lessons
▶️ 1. PHP and the Request Cycle
▶️ 2. Control Flow and Functions
▶️ 3. Arrays: PHP's Swiss Army Knife
▶️ 4. Handling Forms and User Input
▶️ 5. Sessions, Cookies and Authentication
▶️ 6. Security Essentials and Next Steps
▶️ 7. Working with Files, JSON and APIs in PHP
▶️ 8. Organising Real Projects: Structure,…
Course Home