What is the name of having code structured with methods attached to objects?
For example:
" ... ".trim
or
obj.method()
At first many would argue this is Object oriented, but php is Object Oriented(well partially), yet it syntax is completely different trim(" ... ").
TL;DR “Object Oriented” and “Everything is an Object” aren’t valid answers unlesss……
People constantly suggest PHP is “Object Oriented” and libraries are “Object Oriented”, yet PHP library’s code is often structured with tons of static classes.
For example RedBean:
- R::dispense($bean)
- R::store($bean)
- R::trash($bean)
That doesn’t follow the obj.method syntax, yet is supposedly Object Oriented. Is PHP’s object orientation misleading, or is there a better name for obj.method() coding style.
PHP can do both. You can write object oriented code, and you can write procedural code.
Procedural code is much easier to understand and write, and most PHP programmers don’t really understand OOP, so they write, what I call, procedural code disguised as OOP.
This includes things like static methods, and singletons.