🏠 Home / Hub

PHP Basics

Server-side Programming — Basics, Forms, OOP, Interfaces, Traits, Namespaces, Exceptions

13 Lessons · PHP 8 · XAMPP ၊ Laragon မှာ run ပါ
⚠️ PHP ကို browser မှာ တိုက်ရိုက် ဖွင့်မရဘူး! XAMPP, Laragon သို့မဟုတ် PHP CLI လိုတယ်။ ဒီ lessons တွေမှာ code ကို ဖတ်ပြီး htdocs folder ထဲ .php file ကြီး save ပြီး browser မှာ localhost/ ကနေ ဝင်ကြည့်ပါ။
PHP Core — Lessons
01
📝

Syntax & Variables

PHP tags, echo/print, variables ($), data types, comments, string concatenation

<?php$varecho.
02
🔀

Conditions

if/elseif/else, switch/case, match expression, comparison operators, null coalescing

ifswitchmatch??
03
🔁

Loops

for, while, do-while, foreach — array iterate, break, continue

forforeachwhilebreak
04
🔧

Functions

function declaration, parameters, default values, return, built-in functions

functionreturndefaultstrlen
Data & Web
05
📚

Arrays

Indexed, associative, multidimensional arrays, array functions

array()[]array_pushcount
06
🔤

String Functions

strlen, strtolower/upper, str_replace, explode, implode, substr, trim

strlenstr_replaceexplodesubstr
07
📋

Forms & GET/POST

$_GET, $_POST, $_REQUEST, htmlspecialchars, form validation, superglobals

$_POST$_GEThtmlspecialchars

📋 PHP Quick Reference

Syntax

<?php
$name = "Min";
echo "Hello " . $name;
// comment

Data Types

$str = "hello";
$num = 42;
$float = 3.14;
$bool = true / false;

Conditions

if ($x > 5) { }
elseif ($x == 5) { }
else { }
$y = $x ?? "default";

Loops

for ($i=0; $i<5; $i++)
while ($cond) { }
foreach ($arr as $v)
foreach ($arr as $k=>$v)

Arrays

$arr = [1, 2, 3];
$map = ["name"=>"Min"];
count($arr);
array_push($arr, 4);

Strings

strlen($s)
strtolower($s)
str_replace("a","b",$s)
explode(",", $s)

Forms

$_GET["name"]
$_POST["email"]
htmlspecialchars($val)
isset($_POST["btn"])

Functions

function add($a, $b=0) {
return $a + $b;
}
echo add(3, 4);

Other Subjects

🚀 Back to Hub ⚡ JavaScript 🗄️ SQL + MySQL
OOP & Advanced PHP
08
🏗️

OOP: Classes & Objects

class, constructor, visibility (public/protected/private), static, magic methods, PHP 8 constructor promotion

classnew$thisstatic
09
🧬

Inheritance & Abstract

extends, parent::, method overriding, abstract class, polymorphism, final

extendsparent::abstractfinal
10
📋

Interfaces

interface, implements, multiple interfaces, interface extends, Dependency Injection

interfaceimplementsDI
11
🧩

Traits

trait, use, multiple traits, conflict resolution, abstract in trait — horizontal reuse

traituseinsteadofas
12
📦

Namespaces & Composer

namespace, use, PSR-4, Composer autoload, third-party packages

namespaceusecomposerPSR-4
13
⚠️

Exceptions & Error Handling

try/catch/finally, throw, custom exceptions, exception hierarchy, global handler

try/catchthrowExceptionfinally

📌 Study Checklist