Arrays can hold values.
Associative arrays can label values.
But sometimes the data you're working with is more than that
— it's a thing, a concept in your system, something that deserves a name.
That's when objects enter the picture.
Objects give shape, meaning, and guarantees to your data.
They turn loose values into something intentional.
Consider this associative array:
$user = [ "name" => "Tony", "age" => 99, "is_active" => true, ];
It works.
But it also hides meaning:
You're no longer dealing with “just data”.
You're describing a thing — a concept in your system — a domain model.
That's when a class becomes the clearer, safer choice.
A simple class:
class User { public string $name; public int $age; public bool $is_active; }
Now the idea has a name (User).
The structure is visible (public).
The types are guaranteed (string, int, bool).
The meaning is explicit.
Objects turn implicit assumptions
into explicit design.
Objects give you:
Objects are not about complexity.
They’re about clarity.
Arrays can hold data,
but they can't express behavior.
Objects can:
class User { public string $name; public int $age; public function isAdult(): bool { return $this->age >= 18; } }
Now the concept carries its own logic. The rule lives where it belongs.
This is the beginning
of modeling.
Use an object when the data:
Objects are not required for everything.
But when meaning appears, objects make it visible.
Not everything deserves a class, of course.
Avoid objects when the data is:
This is why arrays still matter.
Objects are for concepts.
Arrays are for values.
Objects are not about “object‑oriented programming”.
They're about naming the important things in your system.
Use them when:
Objects turn scattered values
into a coherent idea.
This page is part of a gentle introduction to modern PHP.
Objects are not a requirement — they are an invitation.
When your data starts to feel like a “thing”, give it a name.
Clarity is the quiet foundation of good code,
whether written by you or by AI.
Tony de Araujo —New York