PHP is much better than you think
Fabien Potencier
July 04, 2012
Rants about PHP are everywhere, and they even come from smart guys. When Jeff Atwood wrote yet another rant about PHP, it made me think about the good parts of PHP.
The biggest problem of these rants is that they come from people stuck in the old days of PHP. They either don't care or they don't want to admit that PHP actually evolves at a very fast pace, both at the language level but also at the community level. In fact, it evolves much faster than any other language or web platform. It has not always been the case, but the last 5 years have been an amazing journey for PHP.
Before talking about the amazing things the PHP community has achieved recently, let's have a look at some interesting numbers: PHP is used by 77.9% of all the websites whose server-side programming language is known. WordPress is used by 16.6% of all the websites in the world. If you have a look at the top three CMSes, for the websites that use a monitored content management system: Wordpress is first with 54.3%, Joomla is second with 9.2%, and Drupal is third with 6.8%. Three products written in PHP.
PHP must have done something right, no?
Now, let me tell you a secret, the PHP "tour de force": Despite the changes over the years, PHP is still the easiest language to learn for non-technical people: it allows anyone to create dynamic websites faster than with any other technologies, it allows anyone to host websites cheaply and without any hassles. PHP is probably not the best designed language in the world, but it lets you get things done, and you can't argue with that.
PHP, the Language
PHP 5.0 (released in 2004) brought us a very solid object model... wait a minute, I'm talking about something released almost 8 years ago. Fast forward now. The latest PHP release, PHP 5.4, comes with all the bells and whistles you might dream of in a modern web language: yes, PHP supports namespaces; yes, PHP supports closures; yes, PHP supports traits.
It took some time, but PHP 5.4 also comes with some nice syntactic sugar that
makes the whole experience better than ever: yes, PHP supports [] to define
arrays; yes, PHP supports calling a method on a newly created object ((new
Foo())->bar()); yes, PHP supports getting an array item from any expression
($foo->bar()[1]).
PHP has even learned from its mistakes: register_globals and magic_quotes
are definitely gone.
Last, but not the least, PHP even comes with a built-in web server that eases local testing... and it starts in a matter of micro-seconds.
Next challenges: How do we "upgrade" all the old tutorials talking about PHP on the web? What is the best way to support the WebSocket technology in a PHP application?
PHP, the Ecosystem
Having a good language is great, but having a great ecosystem is even better. And the PHP ecosystem has evolved a lot in the last few years.
Git
I won't talk too much about this one. Git is everywhere and PHP embraced Git pretty fast. Almost all major PHP libraries, frameworks, and products are now using Git, including PHP itself.
Composer
Two years ago, I wanted to get rid of my ugly-PEAR-hack I did in symfony 1 to support plugins. I wanted to replace it with something that was able to manage project dependencies, not a global installer like PEAR. Managing dependencies is not an easy task, so I tried to find the best algorithm to manage software dependencies; I had a look at everything: from Perl to Ruby, from Debian to Redhat. Nothing was satisfactory: only homegrown solutions that happen to work... empirically. Then, I stumbled upon ZYpp. That was it. ZYpp uses a SAT solver to manage dependencies. Fast forward. Thanks to the hard work of Nils Adermann and Jordi Boggiano, PHP now has one of the best dependency manager, Composer.
Yes, PHP has a better dependency manager than any other languages.
And thanks to Git, Composer, and the PHP built-in web server, it has never been easier to download/install/test a PHP project.
Want to test Symfony (using PHP 5.4)?
$ composer.phar create-project symfony/framework-standard-edition
$ cd framework-standard-edition
$ ./app/console server:run
Want to test Silex?
$ composer.phar create-project fabpot/silex-skeleton
$ cd silex-skeleton
$ php -S localhost:8888 -t web/
Don't know Composer yet? You should learn about it. Browse Packagist, the main Composer repository: it already has 1900+ packages available and they have been installed more than a million times in less than 3 months.
Next challenge: include the Composer installer in the next PHP version?
Collaboration
Community collaboration is the most important point of this post; the one I'm the most proud of. We start to see better collaboration between PHP projects, even from the very big ones, the ones you would think are large enough to not care about the others.
phpBB, Drupal, eZ Publish, Symfony, and many others (phpDocumentor, PHPUnit, Behat, Zikula, Propel, Doctrine, Midgard, ...) are sharing code. Yes, they are "competitors" but they all understood that cross-pollination was a good thing. And Composer is a good enabler.
Next challenge: Convince even more projects to join the trend.
Conclusion
Let me say it again: PHP is probably not the best language out there, and I'm the first one to scream about its quirks, but PHP is the best web platform... ever.




Discussion
At last, one of the PHP star answer, and I'm glad to see that it is with a pragmatic approach rather than a fanatic one (I'm sure some will be thrilled and will debate about how PHP closure are in fact anonymous function).
Thanks for this post!
I must strongly disagree for the part when you say that the debian package manager (apt-get) is a homegrown solution! It's, by far, the best package manager around. Look at osx for a bad example!
Would you explain why please? Compared to Bundler for example?
Ok for new coding style on PHP5.4. But the prototyping could be more better for next versions.
To grow up, PHP has to change old attitudes.
Homebrew is the best package manager i've seen to date http://mxcl.github.com/homebrew And hey, it's on MacOS!
Aaaaanyway. Can you avoid remarks like "loot at [X] for a bad example"? What's the point of creating rants inside rant-answering post???
But i'm not sure about one thing in this ecosystem: Packagist.
Composer is a great resource and as an old fan of PEAR for its "officiality", i hope the PHP group will replace PEAR with this.
What i mean is only about Packagist: start searching for "test", "example" or look at "nervo"'s packages, it's a bin for everything!
PEAR is old and unmaintained, PEAR2 isn't a revolution, but Packagist is relatively young, how do you think it will be in a couple of years or with thousands more users?
Appart from that, hard to spot another language able to build from « hello world » to Facebook.
What ? Are you kidding ? You clearly haven't looked at what other languages offer. Bundler is way better than anything I've seen everywhere, including composer.
> $ composer.phar create-project symfony/framework-standard-edition
I'm sorry, but that syntax is horrible.
> bundle install
I do prefer this !
> The biggest problem of these rants is that they come from people stuck in the old days of PHP.
Let me disagree. Jeff Atwood isn't stuck in the old days of PHP. He moved away from PHP some time ago, discovered what is possible to do outside of it and used it.
PHP has indeed improved a lot in the past years. But it's still far behind what many other languages offer : syntax coherence (and not some method camel cased and some other not); real objects, everywhere; big communication problems within the core team. These are the problems of PHP today.
I've worked with many platforms, including PHP, and the best dependency manager prize goes to NPM, no doubt about it.
That tied to the Node.js module system makes an unbeatable duo IMO.
Exactly. You can waste the day away arguing about "pretty" syntax, or you can sit your ass down, write some code, and create something amazing.
composer install
Compare this with Agile methods: Some languages are so greatly designed before being written that they struggle to incorporate new changes (see http://blog.astrumfutura.com/2012/04/php-innocent-villagefolk-or-a-pillagin-pirate/ to understand what I mean).
I did PHP and many other languages.
You either love yourself and strive for using something better.
Or you stick to poorly written languages and runtimes and need articles like this to convince you otherwise.
Do these still use the ridiculous backslash separator?
> PHP supports closures
With painfully convoluted syntax, necessitated by the fact that PHP doesn't know what scoping is. Compare:
$tax = 0.5;
$total = 0;
$func = function ( $quantity, $price ) use ( $tax, &$total ) {
$total += ( $quantity * $price ) * ($tax + 1.0);
};
array_walk($this->products, $callback);
with:
$tax = 0.5;
$total = 0;
$func = sub { $total += ($_[0] * $_[1]) * ($tax + 1.0) };
$func->( $_->quantity, $_->price ) for @products;
> ((new Foo())->bar());
Why not a sane syntax like:
Foo->new->bar;
# or
Foo.new.bar;
Then again, it DOES feel like i'm writing LISP there!
> ($foo->bar()[1])
Did you typo this? shouldn't it be ($foo->bar())[1]?
> PHP has a better dependency manager than any other languages.
Based on exactly which evidence, parameters, arguments. I challenge you here and claim that is entirely wrong. You made the claim, now i expect you to prove your claim, preferrably in your very next blog post, by making an in-depth comparison of the package handlers of PHP, Ruby, Perl and Python.
PHP has done one thing right and that is become the language that every server comes with.
If you look at the highest traffic websites in the world the ones that are using PHP are probably using Zend + some extreme customisation like Facebook.
If PHP was "The best Web Platform" more startups for big websites would be using it. Twitter, Pinterest, Github are just examples of newer big websites that do not use PHP.
Find me a banking website anywhere in the world built on PHP. Or a Third party payment processor like Paypal or Fastspring built on PHP.
I agree PHP is easy, but it is far from "the best". It could use with a very very radical clean up.
- The backslash for namespace, as much as I am not a fan of it, I'll refer you to the RFC : https://wiki.php.net/rfc/namespaceseparator and read up on it, and you'll understand why it was probably the only sane option.
- Your suggestion for closure is just unreadable, ugly, and not in line with current PHP synthax.
- Both of your proposition for the object access on new are in line with current PHP synthax.
- $foo->bar()[1] , agreed on that one.
I'm not sure where it comes from, either, as it's unqualified: certainly I'd disagree that PHP is an easier or more useful language to learn than, say, Python, from a newbie's point of view in a non-web environment. If we restrict ourselves to using a language as essentially a web template script, then PHP is fairly straightforward - virtually the same as a designer learning enough to use Smarty.
The statistics you cite combine uneasily with your closing opinion, "PHP is the best web platform... ever" - popularity is not a good guideline for quality or even ease-of-use, unless your bar for measuring superiority is skewed this way to begin with. It's pretty much equivalent to saying "Windows 95 is the best desktop OS... ever".
"The latest PHP release, PHP 5.4, comes with all the bells and whistles you might dream of in a modern web language: yes, PHP supports namespaces; yes, PHP supports closures; yes, PHP supports traits."
PHP has clearly it has improved in the last few years, but it's still badly fragmented: most non-trivial projects I've used have contained a butcher's shop of coding styles. The ecosystem you espouse is trying valiantly but if PHP wants to compete into the future it needs to draw a line in the sand and basically deprecate all the crap... and there's an awful lot of crap still to deprecate.
I wonder if by the time the big guns like Wordpress and its pals employ all the new language constructs the same problem might not just come around again? Obviously this isn't restricted to PHP, but it is probably where it's most obvious.
However, for those stats about sites using PHP, I could give you the latest trends on TIOBE:
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Yep, PHP is the only one on is kind with "red down arrows"!
Don't get me wrong, I still like PHP and use it, as well as Symfony is one of my favourites. But, I just prefer Python/Django and RoR...
Giving that most of PHP websites are on the 5.2 version, PHP 5.4 is just a cool shiny myth.
> PHP is still the easiest language to learn for non-technical people: it allows anyone to create dynamic websites faster than with any other technologies, it allows anyone to host websites cheaply and without any hassles.
I can't disagree more: that's just what people believe. Ruby is easier to learn and much more consistent, and you can write a Sinatra app and deploy it on Heroku in few command lines.
The key thing to learn from the fact that PHP isn't designed yet still rules the web is that the eco system is what matters. And here PHP is simply untouchable in penetration. Popularity leads to ubiquity, leads to more hands, more jobs etc.
case in point: even if PHPs syntax might be inconsistent in a few places, "easy to learn" for the most part boils down to how easy it is to find a mentor (either a physical one or someone on the web) and here again ubiquity wins over careful design.
That being said, if you get to start from scratch on your startup sure you can choose other alternatives, but expect to have to solve lots of problems that have already been solved in PHP. some people are willing and enable to afford that. and of course there are also benefits to gain from other languages (not the least of which for some is doing something different than what 70%+ of the web is doing).
In reality, PHP is a powerful, popular, well featured, utilitarian programming language that dominates the internet and evolves rapidly to service web application needs. The evolution of the language and its community of users has been stunning. Also, it's a pirate - you can't dump a new ship into the ocean and expect not to be picked clean by us ;). We do appreciate your booty.
In certain peoples' fantasies, PHP is a quirky, bad, poorly performing piece of kiddie nonsense that should be ignored because ignoring your most formidable competitor is a good idea.. Ruby was very good at concentrating that idea by presenting a direct challenge. It didn't work out too well.
Someday, someone will present an actual study as to why PHP is so irritating. Easy to learn, quick to adapt, lower development costs (direct labour), just as scalable as anything else, etc.
Evolution, baby. PHP is a survivor.
Somebody complained about the syntax of Composer based on two examples of "How to get a whole framework running locally in 3 commands". In those 3 command situations you'll never have the CLEANEST syntax, but that is not the point - you're aiming for 3 commands and the fact you can do that means PHP 5.4 has come on a LONG way since previous versions.
Using composer "for realises" is simply a case of running:
$ composer install
I have used bundler and npm. Composer beats the living daylights out of composer and does not require RVM as the code is application specific. It is on par with NPM. Forget about PEAR everyone.
As for the "A Fractal of Bad Design", yes we've all seen it. Some of those points are true, some are out of date and some are just complaints about loosely typed languages. If you don't like weak typing then don't use a weakly typed language. It has pros and cons like everything.
Jeff had many good points, but his article lead to a call to action which wasn't really there. His point is "Stop complaining or do something useful". The fractal of bad design is a nice start for a series of Pull Requests I'd say, especially now that PHP is on GitHub.
The only other recent PHP rant that hasn't been linked to is clearly the best one: http://blog.astrumfutura.com/2012/04/php-innocent-villagefolk-or-a-pillagin-pirate/
PHP is mental. It has grown and evolved in some weird ways, but each version is getting better.
It is what it is. Ruby has some nicer bits of syntax, and so does Python, but Python has some fugly parts to it like the terrible terniary.
Every language has weird and wonderful shit in there and PHP is slowly but surely shaking off some of those weird bits and moving towards being a modern language.
To see how WTF JavaScript can be, why not take a look at WAT:
https://www.destroyallsoftware.com/talks/wat
Case and point: nothing is perfect, PHP really isn't, but it's got a LOT better in the last year and not many people are giving it credit for that.
Objective C and C#, among the exceptions showing a positive trend, are obvious to explain.
The main two languages showing a long term decline are Java and C++ which is always expected as the younger kids underfoot take over more market share.
Looking forward to it, will need to read up on how far PHP has come in the last 6 years...
I've used PHP for about four years now, first as a hobby and now as a profession. The thing I find most frustrating about the language is the people using the language. Because PHP is easy to learn, widely supported and well... everywhere, you will have a whole range of people with varying levels of skill using the language; people from amateurs, to code cowboys (and girls ;) to perfectionists. I like to think that I write somewhere between acceptable and great code now, but when I look back at things I have developed even six months ago, I almost vomit!
PHP is powerful and easy to learn, as a community we just need to ensure that people are learning good coding practices and that old repos get cleaned up with modern techniques.
Having *reasons* for shortcomings doesn't mean you have actual *excuses* for still having them and doesn't make the shortcomings any less of an issue. Also, less ad hominem would be appreciated.
> - The backslash for namespace, as much as I am not a fan of it, I'll refer you to the RFC : https://wiki.php.net/rfc/namespaceseparator and read up on it, and you'll understand why it was probably the only sane option.
The sane solution would've been: "Namespaces equal classnames, let's go ahead with ::." However a lack of prior sane design precludes the latter.
> - Your suggestion for closure is just unreadable, ugly, and not in line with current PHP synthax.
I disagree on the ugliness of syntax itself, but i do agree i could've made it more pretty. Consider:
$tax = 0.5;
$total = 0;
$func = sub { $total += ($_[0]->quantity * $_[0]->price) * ($tax + 1.0) };
$func->( $_ ) for @products;
Or alternatively:
$tax = 0.5;
$total = 0;
$func = sub {
my $item = shift;
$total += ($item->quantity * $item->price) * ($tax + 1.0)
};
$func->( $_ ) for @products;
The point, which you missed, being: With proper first-class closures and a good scoping model, you don't need to declare which variables from the surrounding scope ( $tax, $total ) you wish to use inside your closure, you can just go ahead and use them. PHP fell entirely flat on that count. I'll grant you though, they're not as bad as python closures, where you can only use a single statement instead of multiple lines.
> - Both of your proposition for the object access on new are in line with current PHP synthax.
They are? Between the example Fabien gave and mine i see a delta of 8 parens. Are these all optional or what?
On a lst note: Honestly not picking on you with this one, just a helpful pointer: It's syntax, not synthax. :)
When I started out in Java, it was PHP vs Java, and many said it was not enterprise ready.
Well there is a saying:
"If you have a PHP problem, the Symfony community has already solved it"
More power to the PHP Hammer
When I started out in Java, it was PHP vs Java, and many said it was not enterprise ready.
Well there is a saying:
"If you have a PHP problem, the Symfony community has already solved it"
More power to the PHP Hammer
About PHP, is the perfect language? no..., there is not such of thing... could have better languages or worse, but there is not the "perfect" one.
Even those that think that there are better ones, all is relative... for me PHP has a great comunity, I don't know if the biggest, and "In my personal opinion is the best", that is way I think PHP is the best language for server-side... Do you get it? is the best language due its comunity... so, there are others developers that think the language they use are the best because blah blah blah and that is okay, every one has their own reason....
I would like to remark two things about what Fabien said...
"PHP is still the easiest language to learn for non-technical people"
Of course it's, with such great comunity and information every where....I don't know if that was what Fabien meant, but is the way I see it.
"Next challenges: How do we "upgrade" all the old tutorials talking about PHP on the web? "
Exactly, there are many websites that doesn't apply the best "code", and that isn't a bad thing (at least they share what they know) is just that it could be "better" :D... But we also have that on Java, Ruby, C#..... is just since PHP is the biggest (77.9% or more) we see it more often.
About PHP, is the perfect language? no..., there is not such of thing... could have better languages or worse, but there is not the "perfect" one.
Even those that think that there are better ones, all is relative... for me PHP has a great comunity, I don't know if the biggest, and "In my personal opinion is the best", that is way I think PHP is the best language for server-side... Do you get it? is the best language due its comunity... so, there are others developers that think the language they use are the best because blah blah blah and that is okay, every one has their own reason....
I would like to remark two things about what Fabien said...
"PHP is still the easiest language to learn for non-technical people"
Of course it's, with such great comunity and information every where....I don't know if that was what Fabien meant, but is the way I see it.
"Next challenges: How do we "upgrade" all the old tutorials talking about PHP on the web? "
Exactly, there are many websites that doesn't apply the best "code", and that isn't a bad thing (at least they share what they know) is just that it could be "better" :D... But we also have that on Java, Ruby, C#..... is just since PHP is the biggest (77.9% or more) we see it more often.
I took a stab at development with many languages before I finally stopped listening to the nay sayers and tried out php. Sure I wrote some awful code, but I could actually do it! Any smart developer can find flaws in any language, too... But it takes a smart one to utilize what's available for good (Which you have done an incredible job of in the last several years).
Thanks!
> I have used bundler and npm. Composer beats the living daylights out of [bundler] and does not require RVM as the code is application specific. It is on par with NPM. Forget about PEAR everyone.
Your experience is probably outdated, since bundler does not require any Ruby managers (RVM) to keep all packages locally for a specific application. Bundler does this natively.
PHP falls into the first group. :-)
Sure, there's a lot about PHP that sucks. There's plenty of legacy baggage that hasn't been purged yet. There's still a too-strong procedural-think in places. PHP-Internals is still a case study in disfunction. But you know what? I've been working in PHP for the past 13 years, and I barely recognize the PHP world today compared to just four years ago.
The GoPHP5 project, Namespaces, PSR-0, Composer, loosely-coupled frameworks like Symfony, Closures, Traits... PHP today is so different than anything you're used to in the PHP world it's almost scary. Or exciting. And I really like where it's headed.
No, it's not the best solution for all situations by a long-shot. But it is a viable solution to a huge number of problems, which makes learning it, quirks and all, a very good investment because you can use it in so many different situations.
(And to Christian, I actually rather like the closure syntax in PHP, because it's explicit; Javascript's implicit closures are a ticking timebomb waiting to explode, as they do with a great deal of regularity. PHP got this one right.)
Bundler is build on top of Gem which the package manager of Ruby platform. So, it's the couple bundler/gem the complete system in Ruby.
Anyway, IMHO, trying to compare or argue that Composer is better than Gem a more than 14 years old and successful library is little bit pretentious.
I agree. RVM, rbenv, and others are _NOT_ needed to make Bundler work. In fact, certain features of Bundler overlap that make RVM useless (some Rubyist will argue with me here, but before you do, please try it first). RVM is still a good multi-version manager; however, if that is all you are using it for, then there are better alternatives that one thing and do it well. More that that isn't necessary.
I think the take-away here is that there are arguments made on both sides that are out-dated or just plain wrong. That being said, still, many of the complaints about PHP are regarding it's inconsistency and rightfully so. This can't be refuted. I see so many comments arguing "just fork PHP and fix it"...So, let me make a statement and see if it resonates with you:
"You can't fix PHP's inconsistencies because PHP's inconsistencies are what make it PHP".
While at Zendcon in 2010, it was personally asked (I have a room of at least 300 to confirm this ask) of the PHP creators if we will see inconsistencies cleaned up in future versions.
The answer was "NO"...due to the fact that this would be of little value vs. the effort it would require.
If you think this is easy, you should try it. Not only that, but once you do, I wonder what that pull-request would look like and how much wheel-spinning would go on before it finally got smacked down by Rasmus (closed without merge). Also, what do you do about PHP's lack of expressiveness? Will you write a few thousand lines of C code to fix that? How would that look? Is that really easier than personally learning a couple new languages? What about object attributes? What about instance-level extension (think traits that allow you to "use Something" on a single instance). Ruby allows that -- do you think that will get into PHP 5.4?
Even if it does, what about all the hosts that won't adopt PHP 5.3 until we have PHP 5.6 (or whatever). Isn't this the main sell of PHP...accessible hosting? What good does that do when almost none of those hosts provide you a sane version. That being said, I do know that Dreamhost does allow PHP 5.3 (they get a pat on the back).
OK, back to patching PHP...I'd love to be proven wrong, but I won't be holding my breath and if I catch you holding yours, I'll probably give you a friendly nudge as I don't want to see you die. If you don't respond to my nudge, well then, good luck to you friend.
For me, it's use PHP when absolutely necessary, and when it is not, don't.
When I do, it's version 5.3/5.4, Composer, Symfony2 components, ZF2 components, and anything other light-weight component that works for the task at hand (hopefully it uses Composer, has unit tests, and is highly modular).
I turn down any PHP project that won't agree with version 5.4 or 5.3 (over three years old). If you are a PHP developer, I urge you to demand the same for your own sanity.
If all of the good developers turn their back on crap code, process, and thinking, then the community will get better, or alternatively, that part of the community will form a new one. You might realize that this is actually already happening.
https://groups.google.com/forum/#!forum/php-standards (let the hate for fig begin).
If you don't know how to deploy PHP applications, stop taking customer's money, learn, then start again.
I agree that from a stability and consistency standpoint the closures in default Javascript are worse. However, this is an artifact of the fact that Javascript has just as terrible scoping as PHP has. And this is where a turning point comes in:
In Javascript you can actually fix that. In Javascript you can enable something they lifted straight from Perl: Strict mode: https://developer.mozilla.org/en/JavaScript/Strict_mode#Converting_mistakes_into_errors
The day when PHP receives something like that it will instantly become a much much better language.
print 'sane' if sane else 'insane'
PHP haters are an exception. Most of the websites out there are still running in a PHP environment.
I sometimes think that the roots of this arguing comes to a fight between Open Source and Proprietary solutions.
We are making em lose too much money; come on, of course they are gonna hate everything that's PHP #JustSaying.
The whole PHP6 reminds me of duke and nukem forever where it is coming, coming but never comes, or like Duke a bit late :(
I haven't tried all script languages out there but if you compare the major languages (by popularity) it is the easiest one to find.
I always say that I can teach anyone with no background in web development (nor PHP) to create a dynamic website in a day using PHP. You can't say that for Java or C#!
I am not talking about making someone expert or that the code he/she will produce will be something that we will all be proud of. But it will do the job (tm).
Since the other languages (or frameworks) mentioned are newer than PHP it is expected that they've learned from everybody else's experience, including PHP, to achieve the same or perhaps better results.
But this is temporary. There is always a new feature/language that will either promise or deliver a better thing coming (Node.js anyone?)
What I really hope is that we could shake things in the PHP core team to have a more predictable roadmap addressing the problems, like consistency, that we do have.
Yea, I realize now that php older versions had a lot of issues, but php and the community have envolved and continue doing it.
These discussions are meaningless. Let me do an analogy to explain what I mean.
WE (programmers) are the lord of the rings. WE are in control. PHP suits web tasks, Lua is great for gaming,
if I need more velocity , a C extension for php can fix a bottleneck, if I need a multiplatform app, Java is ok for an standalone desktop app, javascript is great for a rich user experience on the client side, etc .. etc ... etc ....
YOU ARE THE MASTER OF THE RINGS, just choose the appropriate ring for each task.
All languages have strong points and weak points. None is perfect.
I like PHP. Partly because I know it really well but also because it is so easy for me to create my own mini-frameworks that I carry around from one project to the next. I like how easy it is to embed php inside of .css in order to make my pages more dynamic and dare I say it...fun to build.
The PHP Singularity article shows a picture of a double-clawed hammer. I have one too, although it doesn't have the nifty PHP logo on it...Sharpy here I come. The claws one one side have a larger gap than on the other side. This is designed to work with different sized nails. In my case, it is very useful for pulling up old floors that used cut square nails which can easily break inside of the floor. The point here is that it is a single purpose tool which is not always bad. In fact, the only time its bad to have a single purpose tool is when that is the only tool you have and PHP is nothing like that.
Wrong. It's certainly the worst I have used. Composer is a nice way to manage dependencies but for each project we have a single copy of a project.
surprises me, i really adore you as a programmer, it's a surprise to me because you know, that PHP isn't a programming language, python is, ruby is, javascript is.
and i will tell you why, you probably know that but PHP
didn't start as a programmin language, it's a "tags" system.
take this for example:
js: 'Hello'.indexOf('g');
-> -1
php: strpos('Hello', 'g')
-> false
js: !!~'Hello'.indexOf('g');
> true
php: !!~strpos('Hello', 'g');
> error
that is amazing to me.
i think this is what Jeff meant when he said "PHP is a collection of functions" it really isn't a programming language.
but the problem is, it's the only tool that can be deployed just by uploading it.
and by the way, compare silex codebase to Expressjs on node, it's 20% of silex, why ? because javascript is a
programming language, php isn't.
I work every day in php and hate every second of it.
For example, it took 17 years to have a peace of syntaxic sugar like the hooks for the arrays. Before, we had to write array(1, 2, 3). It's just ugly !
«I agre, PHP is the best, there are many programmers and developers that use or make bad practice with PHP. »
PHP itself provides bad code and prevent us to make a beautiful one !
So, all your projects share the same version of a project they depend on? Cool!
"Ruby is the best language you will ever see."
No really, is there a language that doesn't "get things done"? Is it a new term for Turing completeness?
The weakness points of PHP are filled with frameworks nowadays (lack of structure, too much flexbility, etc.)
Sure in some field PHP are not so cool, but in some other no language can beat it.
The average is: the best web platform (ever).