Lecture 01 ยท Fundamentals
Introduction to PHP & Setup
What is PHP?
PHP (Hypertext Preprocessor) is a popular server-side scripting language designed for web development. It powers over 75% of websites including WordPress, Facebook, and Wikipedia.
Why PHP?
- Easy to learn with simple syntax
- Excellent for building dynamic websites and APIs
- Strong database integration (MySQL, PostgreSQL, etc.)
- Fast development with huge ecosystem (Laravel, Symfony)
Setup
Recommended: XAMPP (Windows/Mac/Linux) or Laragon.
info.php
<?php phpinfo(); ?>
๐ฏ Exercise 1.1
Create hello.php that outputs "Hello, PHP Mastery!" and run it on your local server.
Lecture 02 ยท Fundamentals
Variables & Data Types
Variables in PHP
PHP variables start with a $ sign.
$name = "John"; $age = 25; $price = 19.99;
Lecture 03 ยท Fundamentals
Operators & Expressions
Concatenation
In PHP, we use a dot . to join strings.
echo "Hello " . $name;
Lecture 04 ยท Fundamentals
Control Flow
If Statements
if ($age >= 18) { echo "Adult"; } else { echo "Minor"; }
Lecture 05 ยท Fundamentals
Loops
Foreach Loop
The best way to iterate through arrays in PHP.
$colors = ["red", "green", "blue"]; foreach ($colors as $color) { echo $color; }
Lecture 06 ยท Core Concepts
Functions
function sum($a, $b) { return $a + $b; }
Lecture 07 ยท Core Concepts
Arrays & Superglobals
Associative Arrays
$person = [ "name" => "Jane", "role" => "Manager" ];
Lecture 08 ยท Core Concepts
Strings & Forms
Handling form data with $_POST and $_GET.
Lecture 09 ยท Advanced
Object-Oriented PHP
class User { public $name; function __construct($name) { $this->name = $name; } }
Lecture 10 ยท Advanced
File I/O & Security
Always sanitize your inputs using htmlspecialchars() to prevent XSS attacks.
Lecture 11 ยท Advanced
MySQL & PDO
Use PDO with prepared statements for secure database queries.
$stmt = $pdo->prepare('SELECT * FROM users WHERE id = ?'); $stmt->execute([$id]);
Lecture 12 ยท Capstone
Capstone Project: Blog System
Build a fully functional blog system with user authentication, post creation, and database storage.
// Project requirements: // 1. Database schema for users and posts // 2. Login/Register system // 3. Post CRUD functionality // 4. File uploads for post images