Has PHP OO been trying to mimic Java?

Recently I am learning Java, and found that many PHP OO syntax seems mimicking Java. But PHP also copied some syntax from C# as well.

Many people say PHP OO is not very good, but I think for web development, current PHP OO(PHP 5.5) is GOOD ENOUGH to get the job done.

And thoughts?

Has PHP OO been trying to mimic Java?

Short answer: no.

The people involved in writing PHP certainly have no problem in borrowing parts of other programming languages that might be beneficial to PHP’s users, but they’re very clear in that PHP is its own language. PHP has adopted features from any number of programming languages over the years, and indeed rejected many more along the way. PHP is certainly not striving to be Java, C#, or <insert any other language here>.

Any C-based language will share some similarities with each other, such as Java, PHP, C#, C++, and to some degree, Javascript and Actionscript. That’s party of the reason why some languages appear similar–they share similar roots.

But yes, if the developers of one language see a feature, technique, or function that shows up somewhere else, they sometimes implement a similar thing in their language if they find it would be beneficial. This happens all the time.

Well its true PHP’s OO does mimic some Java’s features, but its not like Java holds copyrights/patents to these OO technologies. Languages do borrow from each other a lot, this is explained by Java 8’s introduction of lambda methods. So you see, it’s a common phenomenon, and it’s no one-way traffic either.

programming languages evolve over time borrowing useful bits from other languages. Java didn’t invent Object Oriented Programming (OOP), many of java’s features are ‘borrowed’ from older languages like Smalltalk .

IMHO a bit yes, consider that also the zend framework is written by some schizophrenics java programmers

schizophrenics java programmers

Lol =P I program in Java at my work and I’m probably a little bit schizophrenic too!

Like everybody said, they just borrowed OOP principles at other good languages.

PHP OO is not very good

I think it comes from the fact that PHP is not strictly typed and is a really easy language to get started with. This makes it easy to write code with OOP in PHP, but it’s also really easy to make a mess with it if you don’t know what you’re doing.

With JAVA, it’s a little bit harder to make a mess because it’s harder to start with and you’ll need to understand OOP right away (for most web projects). Don’t get me wrong, you can also make crappy code in Java. But the fact that it’s harder to start with often comes with more experienced programmers (at least, based on my experiences). And, since it’s “strongly typed”, it’s a bit easier to make robust code.

Just to be clear, I’m not saying that a newbie in Java would make a gem and with PHP it would result into a mess.
To summarize: PHP is easier to start with but it’s harder to make clean code with it, but absolutely not impossible (there’s also tools that can help you).