Vote Up 0 Vote Down

advantages and disadvantages of php programming language

What are the advantages and disadvantages of php programming language ?
flag

Answers


Vote Up 0 Vote Down


"we also know PHP isn't the slickest language and the community is looked upon as amateurish."

^^ and people can keep saying this all they want but guess what? There is not one single language that is 'perfect' and bulletproof, and most, if not just about every single successful web 2.0 or startup started on ... guess what? PHP. Because its a tool you can get shit done with without much fuss. Later, as your startup or stack matures and needs to scale, you can evaluate its position and move accordingly or just deal with it.

Facebook still runs PHP, no matter if they convert it to C++ runtimes or not- its still there. With their engineering force they could probably rewrite it quickly in say, Python- but PHP is also dead simple to host and the cheapest to host of them all.

PHP has many advantages as it does disadvantages as any other language.

But still, 2013 as the year of PHP is still kinda silly, because without PHP, you could almost say the 'web rennaisance' would not have occurred in the early 2000s without it (along with jQuery). Ruby (+ROR) wasn't there nor was it as accessible or easy to setup locally, same as Python.

Each of the 3 languages are maturing and there will come a point when they are all equal to one another. THe people dissing one and extolling virtues of another are just adding useless white noise- a lot of us out here just want to build and see other people build cool things.
flag | link |
Vote Up 0 Vote Down
I have used PHP in the past and still do for some small apps. My problem with it is that many of the features feel like afterthoughts. The language wasn't intended to survive this long is how I feel at times. That being said Composer, Laravel and Eden are very attractive. Many of the language shortcomings can be ameliorated through tools and frameworks such as those.
flag | link |
Vote Up 0 Vote Down
I am long-time PHP developer and I wrote a lot of articles here mostly in PHP. I program in PHP 8 hours a day at work so I can say I know it pretty well.

PHP's big problem is that all of us is using it as an object oriented language, but PHP is no such thing. You will find in the official PHP documentation stated clearly that PHP is not an OO language. It mimics some aspects of OO and that's why we expected it to behave like other hard-core OO languages like Java and Ruby or Python.

Than there are the inconsistencies. You said it's not a big deal to know if haystack or needle is first. But than you have eternal change in order between parameter and callback. Than you have array functions, half of them start with "array_", the other half doesn't. Same with string functions, some start with "str" other don't. These inconsistencies are so random that without a smart enough IDE there is no way to program in PHP without constantly looking up documentation.

Finally PHP needed an eternity to implement basic things like someArrayReturningFung()[0] or new SomeClass()->aMethod()... and even today, you can't obtain the last element of an array without actually assigning it to a variable.

So, I can just hope that there will be day when PHP will be OO and it will not be too late.
flag | link |
Vote Up 0 Vote Down


When I entered a python or ruby IRC and asked about this or that and somehow mentioned I have past PHP experience, private chats popped up where people quoted "A fractal of bad design" and even personal attacks occured (try it yourself in #python!).

I think every PHP developer has a story like this to tell. And that leads to a serious problem: Because PHP developers never where taken serious, PHP adapted concepts from Java, because Java is known as a serious language. I think, one of the reason to take Java as prototype for OOP implementation is that everyone wanted to say: Hey, but we are serious. Don't bully us. We're like Java! But Java is compiled.

Hence, PHP developed to a somewhat overengineered language with stuff that matters more in compiled languages (like Interfaces) instead of adding stuff that would matter more in dynamic languages (like ducktyping, monkey patching or a modular system).

This leads as well to new inconsistencies, as Java is a mono-paradigmatic language and PHP is a procedural core, stacked with an OOP that looks like Java. Hence, we have Type Hinting for Objects and Arrays but not for primitives.

We have a rising horror of DocAnnotation Configuration inspired by Java, even if we all know that it is damn slow. Other languages like python have powerful class introspection and built in annotations because they focus on what's a favor for what's cool in dynamic languages and they do not focus on how to rebuild a compiled language in a dynamic language.

We have traits, hat are essentially mixins (as in ruby) or multi-class-inheritance (as in python). But without state and resolved at compile time (resolving at compile time equals tightly coupling).

In other words: PHPs adoption of Java's OOP has lead to many restrictions that do not really have a point in dynamic languages, but it steals many of the freedom that comes with dynamic languages.

That's one of the main problems, PHP is faced with. A developer knows, whether needle or haystack is first in strpos(), so that's not a problem. The OOP implementaion is not elegant, and that's a problem.

Let's focus on features that reminds us that dynamic languages gives us freedom.
flag | link |
Vote Up 0 Vote Down
I feel like most of these discussions and arguments lacks some kind of context. When I started my second career as a so-called "web-developer" I was gladly old enough to know, for myself at least, that my work / my profession isn't the most import thing in my life. I need to buy my family some food, pay my bills and just want to have some spare time to spent some time with things i love. I looked at the web, saw WordPress with a market share of about 14% worldwide and thought by myself "go where the money is", learn PHP and whatever to get a job / business started. That works fine so far, but if some Ruby application will be the next big thing, well, I will learn ruby (or whatever)...so overall I really don't get this "My language is better than yours" stuff.

Even if I understand that those kind of discussions are kinda fun, and we might don't take this too serious, i still wonder why "we" are not able to join forces, solve problems, try to use whatever language to make things easier, create platforms for open communication, to connect the world, start revolutions..etc.

I yet have to find a non tech savy / non programmer who actually gives a $!%ยง what programming language facebook is written in.
flag | link |

Your Answer

Login before answering

Login with facebook