What is Object-Oriented Programming? — a practical guide to What is OOP with clear examples you can reuse in real projects.
OOP Tutorial Series (2/65). Prefer one article? Read the complete OOP tutorial.
Short description
In OOP, you define classes (blueprints) and create objects (instances) that hold state (properties) and behavior (methods).
Core idea
class User {
public string $name;
public function greet(): string {
return 'Hi ' . $this->name;
}
}
$u = new User();
$u->name = 'Asha';
echo $u->greet();