I would like to discuss why is PHP called a structural language? what are the OO concepts that cannot be implemented using PHP?

  • 14
    It's not so much about what "can be implemented using php" (it's turing complete, anything can be implemented in it with enough effort), but rather which principles influenced PHP's design. Of course, if we follow that to its logical conclusion, then PHP certainly isn't a structured programming language, and we'll have to coin a new category... Incompetence-based language doesn't seem like a name that's likely to catch on though....
    – jalf
    Feb 20, 2011 at 12:56
  • 5
    but regardless of what PHP is, it didn't have more than the most rudimentary OOP features until PHP5. Its OOP features are overlaid on top of an old, crufty, sloppy and badly designed structural language.
    – jalf
    Feb 20, 2011 at 12:57
  • @Jalf. Outstanding points given
    – Awais Qarni
    Feb 20, 2011 at 13:01
  • 2
    PHP is a language?
    – Job
    Feb 21, 2011 at 16:50
  • Since PHP5.3, you can add functional. Maybe you can put an AND between theses paradigms instead of an OR ;)
    – deadalnix
    Feb 29, 2012 at 17:19

4 Answers 4


I consider PHP language to be object-capable, not object-oriented. That's because most of the built-in constructs are not object-oriented. Take an array or a string for example. In object oriented language, you'd use it's methods to manipulate it. In fully fledged object-oriented language everything is an object.

On the other hand PHP is object-capable, you can write code, that will be OOP. Instead of using for example normal arrays, you can use data structures from SPL, which actually are OOP. The only problem with that is, it's an extension, not a part of the language itself.

  • @vertec good analysis. I think php is also supporting with many methods to manipulate different things Feb 21, 2011 at 16:45
  • I'd agree, PHP is object-capable, not object-oriented. OOP in PHP can be ignored, that to me is not the mark of an OO language. Feb 21, 2011 at 21:44
  • +1 for distinguishing, in effect, "supports OOP" vs. "allows OOP". May 21, 2011 at 10:09
  • I would be willing to bet though that as development of PHP continues they we will see PHP become more and more OOP than it currently is... +1 for "object-capable".
    – Kenneth
    Sep 1, 2011 at 4:45

Classification of programming languages is an art as most languages falls in many categories. In this case it's simple enough though. PHP is an imperative OO language, like C++. That is, you can select to use objects and classes if you like, but you don't have to.

As regards to what you can and cannot do with objects in PHP, I don't really see anything missing. But "missing" is a relative term here, as some OO languages have more features and others less. For instance, some consider language-supported properties to be a hallmark of OO, something that is lacking in both Java and PHP. Still Java is undoubtedly in the OO camp.

Judging from Wikipedia, the fundamental concepts in OO is:

  • Class
  • Instance
  • Method
  • Message passing
  • Abstraction
  • Encapsulation
  • Inheritance
  • (Subtype) polymorphism
  • Decoupling

All this is part of PHP.

On a personal note, I haven't found anything in PHPs OO implementation that is lacking. There is lots of stuff in PHP that is seriously flawed, inconsistent and just weird, but that is another issue. It's OO constructs are good enough to be called complete.

  • 1
    @ Martin. Hundred percend agree with you.... You have analyzed in very good manner. I am also of the view that we can implement all concepts of oop in php then why some critics still dont agree to call it as oop based language Feb 21, 2011 at 16:08
  • 1
    I fully second that
    – Raffael
    Dec 9, 2011 at 17:16

I wrote an article which might help to clarify this issue!

There is a big dilemma and misunderstanding between programmers regarding the object orientation of PHP. I have read a lot of forums and books on this subject, and I’d like to clarify it once and for all.

Before actually providing my opinion, let me be really clear in something; I like PHP, I am PHP Certified, and I use it every day for Optimum7, a pretty innovative company that I work for as Senior Programmer, and if this would help… “I always program in php thinking in objects”. I can’t do it differently after programming for more than 9 years in C#.Net, where “everything is an object”. But once again, PHP is not Object Oriented!

Let’s make an analogy to clarify this. We can all run, right? But, we are not all “made” for running. The fact that we have the ability to run does not mean we are made for that specific action. Carl Lewis (the fastest runner in his day) was made to run from the beginning; he trained for it; he sacrificed everything to achieve at the highest level. We all know him as “the runner”. He was made for it and he developed it to the max! What about Technical Considerations?

It is said that in order for a programming language to be Object Oriented, it needs to support at least these three basic concepts: Encapsulation, Inheritance and Polymorphism. However, PHP doesn’t exactly contain a ‘full’ complement of these three things, so these words don’t exactly apply to PHP like they do to other languages like C# for instance.

Here are just 3 of the thousands of reasons that clearly illustrate that PHP is not Object Oriented;

1) It does not support casting of objects from one class to another.
2) It was not developed to be Object Oriented i.e. thousands of functions do not belong to any object.
3) “A new PHP” Project (Zend Framework) was created to make PHP, Object Oriented.

Object Oriented Programming is more than a commercial phrase; it is a syntax or API Application Programming. It is a manner of thinking about the problem in a more productive model. As Tom Archer said: “In a truly Object Oriented language, every entity is expressed through the concept of objects. The objects are the main and unique idea behind the concept of Object Oriented”… As I say: Not everything that appears is!

Carl Lewis was made for running, not swimming. PHP supports objects but was not designed to be object-oriented.

  • That's not an answer. Please provide at least a small excerpt from the article (your link may go awol over time).
    – yannis
    Nov 16, 2011 at 23:37
  • hmmm interesting but incredibly misleading. I fail to see how any of your 3 numbered points prove that PHP does not support Encapsulation, (creation of objects); Inheritance, (ability to create objects which inherit another's methods & properties); & Polymorphism, (ability to have objects which conform to a specific interface without dictating anything about those objects). Finally, we KNOW that when java was younger PHP did not originally support OOP this is not speculation, however it does now. Including Encapsulation, Inheritance and Polymorphism, just call it imperative OO & be done...
    – MER
    Jan 23, 2016 at 5:15

1) the first paragraph of the wikipedia-artical on structured prog langs says why

2) there are no OO concepts you cannot apply in PHP

  • 2
    There are no OO concepts you cannot apply in <any language>
    – Raynos
    Dec 9, 2011 at 17:31
  • I've applied OO concepts in bare-metal assembly language, using the assembler's macro abilities. So machine code is also OO. Or at least it is possible to implement objects in assembly language. Doesn't mean it's an OO language though. Nov 4, 2016 at 10:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.