Hacker News new | past | comments | ask | show | jobs | submit login
PHP needs a vision (php.net)
179 points by dave1010uk on Jan 9, 2013 | hide | past | favorite | 167 comments



That closing appeal to deal with the abusiveness of the php.internals list fell a little flat given the opening statement of "shut up". I loved Rasmus' answer to this though.

http://news.php.net/php.internals/64771

    > The vision has been the same for years. A general purpose scripting
    > language with a focus on web development. You are simply saying you want
    > the vision to be more specific than that because everyone has a
    > different view of what web development means. But even if we narrow the
    > vision, it will still be open to a lot interpretation. We try to strike
    > a balance between the different and changing views of web development
    > the same way we strike a balance between appealing to weekend warriors
    > and top-100 trafficed sites. No vision statement is going to answer the
    > question of whether annotations should be in docblocks or in the core
    > language. That's simply not what vision statements do.
    > 
    > -Rasmus
Maintaining clarity of purpose in a project can be difficult sometimes. Kudos to Rasmus for managing to do so in the midst of what looks like it's gearing up to be another php.internals shitstorm.


Personally I find nothing much 'general purpose' about PHP. The language has configuration files! That alone prohibits me from doing anything generic with it.

So all that's left for me is 'focus on web development'. And to be honest: I think today it is not even so good at that. We have server side JS (Node), Ruby, Python and Java -- all freely available with huge communities. Does PHP stack up against these today?

I sure see that back in the days, when cgi scripts in Perl were the norm, PHP had huge advantages over its direct competition in open source web dev land.

To me Rasmus merely underlines the lack of vision, or ability to act on one.


On a more positive note:

I think the Symfony team actually has the vision: provided it has to be with PHP, let's make a full stack web development framework (like Rails) that does not suck, and create heaps of interesting components/libraries that can be used perfectly on their own in the process!

These guys and girls are showing to what extend PHP can be pushed, they also build a fair share of general purpose libs that the PHP community badly needed (e.g.: composer).

It you are looking for PHP with a vision, line yourself up with Symfony: they seem to have it.

Jokingly: If web development is what PHP is useful for, then Symfony simply needs to be shipped with it :)

Plenty of vision is communicated from their site, and it all makes sense:

http://symfony.com/symfony-at-a-glance

http://symfony.com/elevator-pitches


Completely agree. The people behind Symfony (and other embraced projects such as Composer) are dragging PHP kicking and screaming into the modern age.

The support and tooling they've managed to come up with is great, rivalling some of the more mature languages. Definitely a good "side" to hitch your wagon to.


have you ever even tried Symfony? i think a lot of the debate is about how people are starting to get fed up with the Java/c#-like direction PHP is heading. symfony is not like rails, no where close to it. not sure exactly where they started taking the wrong turn but it's really going the opposite direction from other languages like node/python/ruby where simplicity is at it's core.


PHP is one of the major corporate web languages. That is why its heading down Java street. But that's not a bad thing either. Every language covers a specific need. They can't all be everything to everybody. Sure, there is a lot of horrible PHP code (specially in the online ads industry), but that does not change the fact that the language works for the needs of a given market. I don't get why people want to turn PHP into Ruby/Python. If you want that, then by all means use Ruby/Python. If you have to use PHP at work, then make peace with it, and use a more modern PHP style. If you are going to complain, just do it to your CTO or person in charge of choosing programming languages. Though most don't listen...


Where "modern PHP style" is defined by the kind of OO frameworkization excesses that the Java community introduced to the world over 10 years ago. It's not a specific need of the enterprise, it's just a historical coincidence.

PHP happened to be the language that websites were written in at a time when the old Java guard came into management positions, bringing with them their failed ideas of what "professional" software design means.

I don't see why you think it is more justified for PHP to become J2EE than Rails/Django. PHP as a language doesn't support one style any better than the other. The only thing that really sets PHP apart from other dynamic languages is that it is a page template engine by default.

So if you absolutely have to ask one of those "why turn PHP into xyz?" questions, why not ask "why turn PHP into anything other than a page template language?".

The answer to all these questions is, because programming languages are indeed languages. People use the languages they know to say the the things they need to say and they use them to experiment with new ideas. That's a good thing.


I don't see why you think it is more justified for PHP to become J2EE than Rails/Django.

I don't. But like you said (IMO, your comment is spot on), PHP has suffered from the Java mindset. Though I do think that people should not have a language do everything. But thats a problem at the enterprise level, where one size fits all.


You nailed it. Symfony == Poor man's Java. Which is ironic because even Java has started to move to move to something more sensible with frameworks like Grails or Play.


You may want to take a look at Silex, which is based on Symfony2 components.

http://silex.sensiolabs.org/


Don't forget Lithium. Also a great vision.


> We have server side JS (Node), Ruby, Python and Java --

Hey now. Let's not forget everyone's first love: Perl. :D

It's still quietly running quite a few big sites out there, and is currently enjoying something of a renaissance with frameworks like Mojolicious & Dancer, not to mention the releases of 5.10-5.16.


Perl does maintain a strong niche but if the Perl 6 announcement in 2000(!) had been that all focus was shifting to web development Perl would today be king of the heap. It was web development that pushed PHP and Ruby into the spotlight over the last decade, and the 2000ish Java focus on web frameworks also helped keep it popular.


I'd say there's life in the old dog yet given that BBC's iPlayer site runs on Catalyst.

On the other hand, Dr Dobbs thinks:

"...Perl continues its long decline. According to Google trends, the number of searches for Perl is 19% of what it was in 2004. Its declining role in open-source communities further cements the perception that it's in an irretrievable tailspin."

http://www.drdobbs.com/jvm/the-rise-and-fall-of-languages-in...


"I find nothing" is a fairly strong statement. There are plenty of general purpose scripts one can write in PHP. Also config files don't preclude 'general purpose'. For example, run anything in Java and you'll find out there are plenty of defaults running on the JVM that you can override. Yet no one would argue Java isn't a general purpose language. The fact that PHP keeps these defaults in a file is inconsequential.


How is that a fairly strong statement? Here's a much stronger one: PHP is terrible at being a general purpose language. General purpose language doesn't mean you can do things that aren't web dev in it. General purpose means that it is designed to be useful in any application. You know like Ruby, Python, or Perl. General purpose doesn't mean that those things are possible (because I agree that they are possible in PHP); it means that it is a good tool for any job. PHP isn't just an inferior tool for non web dev projects though, it's also barely better if at all for web dev. LEARN RUBY!


I use PHP often for non-web things all the time… I write shell utilities all the time in PHP because it just makes sense: a simple interpreted language, with full access to my app's configuration, database access, dead simple file IO…

The one-liner's are quite nice too… Just today at work I needed to come up with a base64 encoded json string from a data set in an ini file to pass into my Java app via stdin. It was something like:

    php -r 'echo base64_encode(json_encode(parse_ini_file("app.ini")));' | java -classpath Foo.jar com.example.foo.App 
So… yeah. I don't think it's fair to say that "PHP is terrible at being a general purpose language". You just haven't done enough of it yet to appreciate it.


Why is it a crappy tool for non web stuff? It has an absurdly large set of included tools and having all of that in one place is really handy.

More concretely- what's an easy non-web task that Ruby (as you suggest learning) is great at that PHP can't handle just as easily? Not trolling here, I'm genuinely curious.


I find the guy to whom you're replying to be obnoxious, but he's not wrong about it being poor for CLI stuff. Loads of stuff non-obviously behaves differently in a web context versus a CLI context (and while it's documented, you still have to know about it). It doesn't have good stream processing facilities. It, as mentioned, requires a php.ini and requires you to think about that when you're writing scripts in it.

It can be done. It is not something I would recommend under almost any circumstances. (But, then, I wouldn't recommend Ruby for any-any circumstances, so...)


The only real differences from running PHP/CLI that come to mind are:

* PHP_SAPI is defined to 'cli' (as compared to 'fastcgi' or similar)

* $_GET/$_POST are empty, and $_SERVER is missing the HTTP_XXX variables (duh)

* By default, there's no max execution time

I dunno, it works perfectly fine for me. It's certainly easier to read and write than shell, and I genuinely can't think of a time that an ini directive had any effect on what I was doing - unless you count the presence or lack thereof of an extension, but everyone knows that PHP's extension handling is pretty crappy.

I guess it all depends on what you're trying to do. I agree that stream handling is a little rough, although that has little bearing on what I tend to do (YMMV).

At the end of a day, it's a tool, and I have tasks that need to be done. That tool either is or isn't capable of accomplishing those tasks, and based on my own abilities it may or may not be faster than using other tools (contrary to popular opinion, I find Ruby extremely painful to work with, and avoid it at all costs; if it works for other people, good for them!)

This could be a case of "when all you have is a hammer...", but maybe I just happen to have two nails: http://www.codinghorror.com/.a/6a0120a85dcdae970b017742d249d... ;)

/edit: typo


> More concretely- what's an easy non-web task that Ruby (as you suggest learning) is great at that PHP can't handle just as easily? Not trolling here, I'm genuinely curious.

Is there a decent analog for Nokogiri? I stopped paying attention to PHP 6 years ago so I don't know, but a friend of mine needed to do some webscraping today and learned Ruby and then built his script in 5 minutes.

I checked the IRC timestamps between his "it's done installing" and his "hey, look what it outputted". It was seriously 5 minutes. He then went on to do something a touch more complicated (scraping multiple pages and a trivial analysis/report of the results) and that couldn't have been more than another 30 minutes.

(ETA: I don't know if you'd consider webscraping to be non-web. I guess we could swap it out for a bunch of XML files since that's basically the same task.)


PHP has cone a long way in 6 years. Here's a really good PHP web scraper that looks comparable to Nokogiri: https://github.com/fabpot/Goutte


Several reasons:

* The bindings for making anything GUI-ish lack. Horribly. I doubt there is one application like an editor written in PHP; that is actually used. * Its long-threads are ... lacking; You cannot write anything deamon-ish in PHP. * Memory management, as Ramus puts it, is not a concern "I just restart Apache". That makes it unusable for anything bigger then a small CLI-tool. * The Cli-libraries are decent, but far from things like Ruby's Thor.

You can write CLI-tools just fine, but "general purpose" is much more then "Managing Web-Content And Some CLI tools".


Check out Phabricator, it has daemons that are very well managed and cli tools that are fully featured. Arguing that it's unusable for something large is just wrong. The way you manage memory in PHP is the same you way you manage it in any other language; you write /good/ code.


exactly right. PHP is like the justin bieber of programming languages.


I think that Rasmus and Anthony seem to have two different thoughts on the word "vision". Anthony was very specific in the fact that his concept of a "vision" is about the paradigms PHP supports:

> 1. "PHP Should Strive To Be A Full Featured Object Oriented Language".

> 2. "PHP Should Remain A Procedural Language WIth Some OO Features"

> 3. "PHP Should Be Implementation Neutral, and Support All Paradigms Equally".

Rasmus' response was more general, about the vision for who and what they'd like to enable with the language.

There may be a bit of cross over, but they are two distinctly different views. And for what its worth, I think both are correct. I think PHP should choose to be one of the three things Anthony suggested, and stick to it. This would help in discussions about what features to take on board in new versions. I also think that Rasumus is right in that PHP is a general purpose scripting language with a focus on web development. However this is more about the type of people you will get interested in using and contributing to the language.

EDIT: Grammar


How using vague terms like "Full Featured Object Oriented Language" is "very specific"? Every OO language out there has different set of features, and the only thing this definition is useful is for bashing opponents over the head with "ah, you don't want this feature? But language X has it, and our vision says we have to be full-featured, so we need to add it no matter what!" Java has checked exceptions? Then PHP should have checked exceptions, otherwise it's not full-featured. And so on. I don't see this as specific vision, but rather as a cart-blanche to abandon reason and consideration. I'm not sure if "specific vision" is possible but using vague undefined terms like "full featured" does not make it specific and it is impossible to reasonably "stick" to it as nobody really knows what it means.


I come from a C++ background, and early last year tried my hand at web development.

After hearing about all the stuff about how PHP was an "old", kludgey language, I tried to learn python, and go the webpy. It was doable, but I kept running into issues all the time.

I gave up and switched to PHP, and I have to say that it was a much easier experience. For the most part, everything just worked. Regardless of how kludgey its history is, how inconsistent the syntax is, etc, it really does work well. I'm now doing PHP development at my current job and it's been fine.

One thing I learned from a previous job was the saying "Your customers don't care about your technology. They care about you solving their problems." If you are solving their problems, they will pay you, regardless of whether or not your back-end is CGI, perl, PHP, or whatever.


I don't do much PHP anymore but I can see the appeal coming from a c/c++ perspective. When I was doing PHP I felt closer to the metal than I feel with Python now.

A lot of the PHP libraries looked like thin wrapper over well known c libraries. Instead of shoehorning everything to make it PHPonic, the function calls were similar to their c counterpart. You could sometimes even read the man pages for the c libraries if you needed extra details on how the internals worked.

There was a simplicity to this that was appealing to me. The lesser amount of magic and abstraction meant I could more easily visualize what was happening under the hood and find bugs quickly.


    "PHP Should Be Implementation Neutral, and Support All Paradigms Equally".
This is what I like about PHP. When you want a 4 page site, you can use procedural and functional programming. When you're working on an enterprise level CMS you can whip out the OO paradigm and you're set. PHP is a messy soup but it does web better than most other languages.


One nice side affect of this is that PHP can suit both novice and experienced programmers. Newbies don't have to learn OO before they write Hello World.


Yeah, and thanks to this, you end up with a "beast" like Magento, written by "experienced" programmers, and then you have novices tasked with writing themes and components for it, but it doesn't work that way because the "beast" is not "black boxed" well enough for the novices to ignore it. (I keep quoting "experienced" here because the example Magento is just "Java written in PHP" and I'd fire anyone turning up this type of code.)


Having had the unfortunate experience to work with Magento recently, I completely agree with your evaluation. My reoccurring thoughts were exactly "this is Java written in PHP!".


Then please spread the word and stop clients/managers from choosing it! Let's stop others from falling into the "look, it even has ebay integration!" trap!


Unless you can offer any real alternatives to Magento I have to call bullshit, yes the framework is far from perfect and PHP is not the prettiest language.

But calling Magento "Java written in PHP" without offering alternatives, specific criticism or any backing of the argument is just childish.


That's also a problem because anyone with a day experience in PHP can claim to be PHP developer, and often companies can't really tell the difference between an experienced and non-experienced programmer. If they can do PHP, they can build our website and we end up with horrible unmaintainable code. I think that's why PHP has such a bad reputation.


...naah, any kid can learn Brainfuck in a weekend ..."real" programmers don't even need a 100% Turing complete language to get the job done: choose Malbolge instead! (http://en.wikipedia.org/wiki/Malbolge)


maybe we should all switch to brainfuck for web development then so we can weed out the stupids [/sarcasm]


I get your point, but being easy to pick up AND easy to make dangerous mistakes is a bad combination. The goal isn't necessarily to "weed out the stupids", but rather to prevent bad practices from propagating. "Too easy", in my view, means having a rotary saw with no guard and a hair trigger.


PHP suit "experienced programmers"?

In a way this means nothing: experienced programmer can program in any language.

In another way it is wrong: experienced programmer know how so well that building a solid application on rotten grounds is a pain, and would prefer a more solid ground to build their application upon.

Do I need to list again all the mess in PHP?


No. No it doesn't. It does it easier. That's not the same thing.


When it comes to the web, lower barrier of entry is actually a value in itself.


PHP works fine as long as you're never exposed to a better way.

In a year or two start using rails. You'll come back to PHP and wonder why anyone would ever make a hammer with two claws.


You're confusing a language with a framework.

A more apt comparison is rails with symfony2 or zend framework2.


You're right. Still I can compare doing web development using ruby on rails with doing it in php without a framework.

I've done both, rails was much more pleasurable. See? I just compared the overall experience of a language with that of a framework.


You just did it again. Why would you compare Ruby on Rails with PHP?

Do you realize what you're saying?

edit: replied to you as if you were fleitz. Point stands as you basically parroted what he said.


Are the sort of people writing straight PHP the sort of people who would be using rails? Try a PHP framework like Laravel and then compare that to Rails.


I took a look at that, it appears that you unzip the framework and then start modifying it directly. After you "upload it to your webserver". Deployment? Source Control? No, not in PHP, you just modify shit right on the webserver.

I'm sure this process makes upgrading painless, just unzip the framework and... wait... all your changes just got overwritten.

This kind of crap is exactly why everyone with a clue laughs at PHP.


No. Everyone knows that you do not modify the framework files. Hell, everyone knew that you do not touch the framework system files years ago with older frameworks like CodeIgniter, so it makes me doubt that you have any experience with PHP frameworks at all.

You would upgrade your Laravel framework with composer, which runs on Git. And it'll most likely just work without any "Gem hell" that i've come to experience with some other languages.


Yet the framework docs say none of this. Look at rails, it tells you, put your gems in the gemfile.

Laravel says, hack shit directly on your webserver.

If you're supposed to use composer, why don't the docs say this? Instead the docs say, unzip and hack.


The docs don't say that you would update the framework via composer (though this may change when Laravel 4 is released) but they do say that you should just replace the "laravel" folder with a new version using whatever method suits you best, which can be even easier. It certainly seems easier than upgrading Rails, since then you can update your whole remote application code and framework in a single push.

The docs clearly explain that your bundles go to the "bundles" directory, controllers go to the "controllers" directory, views belong in "views" and so on. And your whole application resides in a directory called... "application". You'd actually have to be pretty advanced and amazingly stupid at the same time to make a functional app in the framework core folder and than destroy it by overwriting.

Rails docs don't tell me to unzip the framework and start hacking, but they do instruct me to run "gem install rails", wait a couple of hours till it's done, then run "rails new blog", "cd blog" and then start hacking. Neither set of docs tell me how to setup version control before i begin my work, and they shouldn't. That's not the job of the framework docs.

And of course you're gonna hack your application directly on the server, albeit a local one, as PHP applications are typically developed. This in no way prevents you from using version control and proper deployment techniques.


Nothing stops you from using source control with PHP. Nothing stops you from working locally and then pushing changes up to the server. You make no sense.


Wow, you're the type of developer who would leave an absolute mess in his wake.

Everything you said I rail against daily. Stop bringing your bad habits into PHP, we have enough of them already.


You really have to be kidding...


The problem with php is that is scales terribly with the size of the codebase. Try to move away from the comfort zone of the language and the size of the project and it changes a lot.


The opposite, actually. PHP's shared-nothing architecture makes scaling a breeze. Just add more hardware.


I believe you misread parent. The size of the codebase has little to do with the resources needed by the software.


If this is the case, then maybe PHP's role is a rapid prototyping language which is replaced when the codebase gets to a certain size.


Generally that size is not more than about 5 files.


Yeah good one. Wordpress is a great example of a huge failure written in PHP over 5 files, right?


The codebase of Wordpress is an utterly terrible, offensive, kludgy, hacked-together mess of spaghetti code. The last time I looked at the internals it still lacked a coherent MVC structure. There are big, good things built with PHP, written the right way with solid software engineering principles, but Wordpress is not one of them.


Yeah, it's very evident in the fact that no one uses it, too. PHP sucks.


If number of users was equivalent to quality you would be correct. But it isn't. Under your argument, Wal-Mart is a purveyor of family heirlooms.


The number of users is not equivalent to quality. It's an indication of quality.

As for quality...

No, Wal-Mart isn't a purveyor of items with the qualities of being expensive, extremely limited, and old.

Quality is a subjective word, defined by different aspects. Just as I can, with justification, define Apple as a purveyor of low-quality hardware, I can say equally it sells high-quality software.


It's not even an indication of quality, it's an indication that many people use it.

I guess you can quibble about definitions all day if you like, and you can take "family heirlooms" literally instead of metaphorically as it was intended, but that won't make Wal-Mart a seller of quality items nor will it make PHP a well-designed language under any sort of definition that is relevant to reality.

And, honestly, if the only thing we're going to argue about is whether or not quantity equals/implies quality and the definition of "quality", the argument against PHP has already won.


As you say, quality is defined by a number of factors. I'd say that a good, high-level general purpose programming language should be:

- coherent

- non-verbose

- provide solid high-level abstractions

- safe

- have a solid standard library

- optionally, easy to get started with

Of all these qualities, PHP is geared toward "ease of access" with a sprinkling of non-verbosity, and fails mostly or totally in the other categories. Just like the popularity of the Millenium trilogy does not mean Stieg Larsson can write, the popularity of PHP is more an indication of its low barrier to entry (especially combined with widespread hosting support) than anything else.


> Just like the popularity of the Millenium trilogy does not mean Stieg Larsson can write

Technically, it does. =)

I'm surprised you wouldn't consider the license a language is released under as one of the factors. Or maybe you do, and you forgot to list it. And therein lies the issue: the number of people are indicative of certain qualities, qualities you might not consider important, or might not weigh as highly as other people.

I love erlang, but I'd be hard pressed to use erlang for as many projects as I would like. Not because of failings of the language itself, but because certain qualities it does not possess (ubiquity for one, which affects so many other areas).


Yes, it is a "good one." Wordpress' source looks like spaghetti with shit sauce. The fact that it runs is a testament to something, but not the readability, maintainability, or usability of the code base. Those people wouldn't know a well-designed API if, well, fill in the rest here.


Good point. Must be why no one uses it.


Whatever else you are, you're not too stupid to see what's wrong with this argument. So the fact that you're forwarding it anyway means you can't make a real point, or you are trolling.



Facebook _doesn't_ run PHP. A large portion of it is coded in PHP, but it runs C++ through HipHop[1]. Facebook may as well be written in anything that compiles down to C++.

1: http://en.wikipedia.org/wiki/HipHop_for_PHP


Actually, the difference between compiled C++ code, and the newest version of PHP with APC/Xcache is not that drastic, but facebook needs to squeeze out every bit of performance so they can to cut down on the number of servers.

For what it's worth, PHP 5.4(without APC) performed better than both Python and Ruby on that language shootout page: http://benchmarksgame.alioth.debian.org/u64/which-programs-a...


By that standard, anything may as well be written in a language that eventually results in machine code being executed.


Actually, facebook is moving to a JIT model and getting better performance out of it than the crosscompiled code.

http://arstechnica.com/business/2011/12/facebook-looks-to-fi...


If you have experience in c++, I have used Wt [0] previously for webdev and found it pretty straightforward (it's like Qt for the web) and extremely performant. Dual license GPL/commerical.

[0]: http://www.webtoolkit.eu/wt#/features


> everything just worked.

That's the scariest thing about the language. The php will run whatever you write in the script; assuming things, hiding errors, etc..


It sounds like you've never properly programmed in php a day in your life. Stop spouting nonsense. If you're going to develop in php, you do so in strict mode with all errors turned on. Doing otherwise makes you part of the problem.


I'll accept this argument when PHP starts shipping with sane defaults. It's only quite recently that register globals got turned off in the default config.


Global registers were deprecated in 5.3.0, and completely removed in 5.4.0

http://php.net/manual/en/security.globals.php

5.3.0 is 2 and a half years old.


and many shared hosting providers are still on 5.2, and many crappy old scripts require register_globals on.


And that's PHP's fault? It won't affect you if you start writing a PHP 5.3 (or even 5.4) app today.


Yes, it is PHP's fault. It's endemic to the general attitude of the PHP team.

"Now just marginally less braindead than every other language" isn't exactly a selling point.

Sure, it used to be worse, but I see zero commitment from PHP to actually make real steps to fixing the situation. A real first step would be to start working on a 6.x release that actually removes the gazillion deprecated-but-still-present-and-thus-used things in the language.


Stas responded here: http://news.php.net/php.internals/64775

"PHP's vision is being simple and practical and focused on the web. PHP is what people use to get their first site off the ground. PHP is what a web designer learns when he/she wants to go into programming. PHP is what a random Joe uses when he needs to whip up a page and he's in "do it yourself" mind. PHP is what you expect everybody to be able to handle, and everything to be able to run. It is not to serve everybody, every use case and every possible need."

Frankly, I don't understand this vision at all. Is PHP supposed to be a beginner's language that a webdev eventually moves on from? I mean, don't get me wrong: I used PHP for exactly that when I graduated from high school. But is the directive really, "Real programmers don't use our language"?


That vision is stale and cancerous for the PHP community. The directive is and always has been along those lines, "real programmers don't use PHP". For some reason the core team has pushed that. There are a lot of us who use PHP full time who would also love for some real, cohesive decisions to be made in favour of bringing vision to PHP. Sadly the internals list is always just a shitstorm.

Anthony's view is that of someone trying to make the language better for those of us who use it day-to-day. To make it a real contender in web languages, because it does have that potential.


So PHP just has a "potential" to be a "contender" in a world of web languages, but only if it does what you like it to do, otherwise it's hopeless? In what world do you live in? What color is the sky there? In my world, PHP is already one of the leading tools used for web development, and has been there for years.

>>>> The directive is and always has been along those lines, "real programmers don't use PHP". For some reason the core team has pushed that.

This is false, core team never pushed anything like that.


Python has often been called an easy to learn language and a good first start because it tries to be easy to read.

Does that mean that it is also a beginner's language that people eventually are supposed to move on from?


People who pickup Python will always stay and never move on completely.

My programming carear startet with perl -> php -> python and i found one holy grail to solve most of my problems. Python had an easy entry point the same as PHP but when you jumped over the first learning curve and discovered the complete ecosystem it`s mindblowing.

I never had that feeling with PHP you could do websites and thats it. And most of the time it gets a mess real quick. PHP will slowly phase out over the next decade.


I picked up Python and am now using Node/CoffeScript for web dev. I'll probably transition to Clojure in the future and I'll try Haskell after that.

> PHP will slowly phase out over the next decade.

Wanna bet on it?


> PHP will slowly phase out over the next decade.

Wordpress.

It's become a full blown CMS and its own platform. Half the media sites out there are running it, or hosting with Wordpress Pro. Then there's a horde of casual bloggers managing their own installs.

Granted, there's movement away from this kind of publishing model(Facebook, Twitter, G+), but as long as Wordpress is still the go to, "set it and forget it" app on $5 webhosts, PHP will not die.


Python was my first language. Haskell is my #1 language right now, and I do Java professionally. There have been many between.

It's a nice language, but it's not for everyone.


> People who pickup Python will always stay and never move on completely.

To be blunt, that's not universally true. I've moved on to Go, with an eye for more functional languages this year.

Python is great, but it's not the last language.


The difference is that Python is actually a designed language, rather than an unholy congealed mass.


Except that Guido never said that Python is meant only for a "random Joe" to "whip up" a script when "he's in a DIY mindset".

ETA: In fact, compare:

http://www.python.org/about/

http://php.net/manual/en/preface.php


This is one of the points I always try to make with other tools... if you can do what you want with it, and it suits the needs of your project, you don't need to "move on" to something else.

Sure, it's good to keep your mind open, investigate other possibilities, and keep your eyes forward... but if you're able to draw the pictures you want and like, it doesn't matter if you're using crayons or oil paints.


Nowhere there it says "that a webdev eventually moves on from". It says it should be simple enough to start from. It does not say it is required for it not to be powerful. But when power conflicts with simplicity - we should prefer simplicity, within the bounds of reason of course. I believe we still have very good power - and popularity of PHP so far proves it enough, I think - but we probably won't be able to do some things. Like if you expect full lambda calculus and Haskell-like monads in PHP, it is not likely to happen soon.

>>>> But is the directive really, "Real programmers don't use our language"?

Of course not. How any of the examples given about say any of the people mentioned aren't real? Do you consider real programmer be only guy who writes incomprehensible code in incomprehensible language that does incomprehensible things?


Too late if you ask me, let me explain:

Programming languages are hard to change, very hard, because it will certainly break programs written in it in many places. So if you want a programming language with a vision you should start with it, or simply accept it has no vision and it merely goes with the whim of its maintainers. The latter is what I believe happened to PHP. No biggy, there are plenty of languages that do have strong visions and are very suitable for web-development; just move on.

If PHP was to implement a vision, it would soon not be PHP anymore, whether that is a good thing is up to the users of that language. In that case I foretell a hack of a lot of porting effort and a fork (facebook?)... :)


PHP has changed a lot over time. It moved from a C-style procedural language to very Java-esque object oriented language. "PHP" hasn't been "PHP" for a long time already.

It's always hard to do large language changes, but it's not impossible. E.g. consider the change that PHP did from version 4 to 5. That was a pretty major paradigm shift, with lots of broken code, but it worked out well in the end :)


To me the OO features of PHP have always felt 'bolted on', yet Java is OO from-head-to-toes. It only emphasizes my point: unlike a startup, a programming language cannot pick/change vision when it is a grown-up.


Probably because they were in fact "bolted on". Saying that Java is OO from head to toes, I can't agree with. Java has primitive types as well, and not everything is a first class object (like methods). Python is more OO in that sense, for example. In a sense, Java is having trouble incorporating modern features in the language too. Just take a look at how generics are implemented, and the endless closure debate.


Python? Try to subclass an int in Python, and see that it is not as OO as you think.

Ruby is more OO then Java for the reason you give, still there are primitives but they have a thick OO-coating so you are less likely to notice they are 'different'. Try subclassing a Fixnum -- it works! But Fixnums have no 'new'.


> It moved from a C-style procedural language to very Java-esque object oriented language

The funny part is, it did not make things better.


> PHP has changed a lot over time.

Mostly in the way that stuff was added.


Personally I think PHP has a bad rap for two reasons:

First: Community like HN and such, have lot of good and smart people, however, lots of us are what I like to call "tech hipster", they like to always brag about how they prefer some new-shiny language/framework whatever, as if that means they know more than the average developer. Like an hipster when it comes to some underground-indie-band.

It's pretty fun to see this, I laugh quite a lot TBH. And because of this PHP is looked upon as a mainstream language, like POP music, always number one on the charts, always on the frontpages, but like POP it lacks quality, good taste and so on (what some people think at least).

So, many of us, just hate PHP cause it's POP and using a POP language is cheesy and lame...whatever...and they just hate PHP because they read someone else's saying it sucks. eg: "PHP sucks, because I use X"

Second reason: Other people on the other hand, have really fundamental reasons to dislike PHP, however, I noticed that a lot of these people haven't used PHP since version 4, and they are completely out of the current state of PHP. I don't mean everyone, but most of them do.

I'm not a PHP fan or anything, in my work I have to use it, although I really wish I could use Python, but I can't. So, instead I try my best to use it in the best way I can.

I'm currently using Symfony2 framework, which brings a lot of good web dev practices into PHP world. I'm looking at Laravel as well.

To be, most people still think PHP developers use a PHP as a single file where they put PHP function on the top tof the file and html at the bottom and such...and if you a good developer you can really make PHP shine these days, because there a good tools and frameworks out there.


Nice analogy with the indie/mainstream pop, and I couldn't agree more with the techno-hipster with their 'cool' underground languages. PHP is still the bread and butter of the web, wether you like it or not.

I can really recommend the Laravel framework, it's quite elegant!


I couldn't agree more, and I'm a fan of PHP. It's a swiss army knife of a language, allowing you to program however you want. C programmers can code procedurally and java guys can jump in and basically go all out with the OOP constructs provided. I've watched PHP get better over the years, and it continually does so, but after having switched recently to Ruby, I have to say a solid "Benevolent Dictator" would probably not be such a bad thing for the language. Ruby has its paradigms, its own way of doing things, and you frankly can't develop software in many ways PHP allows you to, but for me Ruby is still a much more succint and beautiful lang, one I enjoy programming in more, I think partially because it has this, a set way of thinking about software design. I mean unit tests are in the stdlib for example, and you can't program long in the language without using utils, gems, etc, that all are chalk full of test suits that pass.

IMHO, a programming language should not just focus on itself or whether it has such and such feature, but on how it can be used in the entire software development cycle. This is something Go and Ruby are doing exceptionally well, and is why I like using them so much to build software, whether its web or otherwise. Probably because of its history as a template language embedded into HTML (way back when :), PHP has still got some growing pains in order to build up its software development paradigms, but I'm still hopefull, it has gone amazingly far and continues to improve.


PHP has never been about the "language" as far as I see (hell, it was a templating system "evolved into a language"!), but about the platform (language + libraries + server + tools and what this meant for deployment and scaling).

PHP (the LAMP "web development platform" that happens to include the PHP language) got so popular because:

1. ease of deployment

2. ease of scaling

3! KISS by keeping the layers of abstraction few and thin (at first it was just a thin "templating" layer to reach the functions in C libs)

Only (3) has anything to do with the language itself, and is the only one the could translate to a language "vision". If PHP were to remain true to itself and its advantages that made it what it is today, their vision can only be to keep the layer of abstractions few and thin and this can only mean 2 and 3 from the OPs rant: procedural, functional and multi-paradigm enough to support OO (I know, people don't write functional code in PHP but I think they should - it really helps with KISS once you go over the "procedural brain rot").

P.S. As a developer I hate PHP (viscerally, passionately, religiously and in all other ways imaginable)! As a manager I absolutely love the "fail cheap, fail fast" philosophy and PHP is one of the few languages that enables this "flow".


Wow. I must say I'm surprised (not in a good way!) by the lack of quality of a number of the comments here. I already knew that PHP isn't the language of choice of cool programmers, but at least they make some sort of informed decision. Some of the comments here ("PHP must die!" and "I use Rails" or "I switched to JavaScipt") really show a lack of understanding about even the most basic concepts of PHP, or programming in general.

I'm the first one to admit that PHP has its flaws, but that's not to say that other languages are perfect, or 'better'. PHP is a Frankenstein's monster, and no matter the quality of body parts you schlep onto it, it will probably still work. Ruby on the other hand is stricter, more consistent. If you're new to programming you can hit the ground running with Ruby (especially with the Rails framework, but if you're new to programming, would you even know how a framework relates to a programming language?). But if you want to go beyond a simple CRUD-app, Ruby poses a lot of challenges that can be hard to solve whereas PHP, well, just works.

My point is: you pick the right tool for the right job. For a lot of people, the right tool is PHP because it's the only thing they know. That's not PHP's fault, now is it? This kind of thinking reminds me of the clash between Apple fanboys and Fandroids: to each their merits, but you can't seriously state the one's perfect and the other one is utter rubbish.

Wether you like PHP or not, it's still: a) the most popular programming language b) the programming language with the most job openings (Source: http://www.udemy.com/blog/modern-language-wars/) This has to count for something, right?

So please, for the sake of keeping HN a decent place, refrain from using non-argumented statements like 'PHP must die'. You're not adding anything to the discussion and you make yourself look like a fool.

As for the 'vision of PHP': I'm glad there is none. It's the gateway drug to a lot of programmers, and I'm sure that I would have given up on programming if it weren't for PHP. When I look back on some of the stuff I wrote some 10 years ago I just want to cry, but that does show that I've grown as a programmer. It's perfectly possible for people to start out with PHP and evolve to good programmers, regardless of language used. A stricter defined PHP would just kill that.


> But if you want to go beyond a simple CRUD-app, Ruby poses a lot of challenges that can be hard to solve whereas PHP, well, just works.

I write PHP professionally. I like PHP programmers. I'm starting to have a soft spot for PHP. PHP and its standard library are a minefield.


I think PHP (5.x/6x) is still applicable to any developer, new or old, experienced or not. Many of us cut our teeth on PHP's simple scripting concepts, and that shouldn't change. And from what I've seen from past history, it won't.

There is a tremendous amount of backwards compatibility in current versions of PHP that allows one to follow the same approach to Web development that those did back 10-15 years ago with PHP 4. No, it is not "Enterprise", and yes there are security considerations to account for. But the process of adoption is key, and PHP continues to be adopted by a lot of startups/projects. Those that choose to adopt the PHP language as their advanced vernacular moving forward still continue to have a number of more advanced programming language concepts to utilize in PHP with each new release, with barely any breakage with other approaches to using PHP.


"Many of us cut our teeth on PHP's simple scripting concepts" -- The Gateway Drug :D

I went Perl -> PHP and have been there ever since. Not because I'm too lazy to learn another language, but because it has done everything that I have needed it to do, and when I found something that it couldn't, I looked elsewhere for that one aspect of the project.

Isn't it our role as developers to push the boundaries of our chosen language? I'm pretty sure back when Javascript was being thrown around, they wouldn't have imagined what it is today.

Trying not to sing praises, and throwing fuel on a fire that should have died a long time ago... To each their own.


PHP is for webdev. That's it. Go outside the bounds of that and it loses its magic. On its own it's great for spitting out a webpage. It's a scripting and templating language in one, which is kind of cool.

That said, outside of that to make PHP work on bigger projects you end up with a lot of structure and ceremony that make PHP suck, not quite as much as Java, but it's not amazing.

Thiings like testing and testability aren't much fun in PHP. For a long time package management was a joke.

PHP is for webdev. That's it.


I can't agree with that. Personally I happen to use PHP not for web development, but almost exclusively for system administration and monitoring (I'm not a web developer). It's very comfortable using PHP in these areas, as:

- PHP and many of the PHP extensions are packaged for about every major OS and architecture

- a lot of functionality is already shipped with the interpreter (so no additional stuff necessary)

- it's very easy to deploy We've tried a number of options, especially in the monitoring area, but PHP eventually seemed to be the most suitable for the job.


Deployment is "easy" because you just copy a bunch of files, right? Reproducible deployment takes a little more effort, but it's well worth it when the time comes to upgrade a server, or a pipe bursts on top of your existing one.

Python has your other advantages, quite a lot of existing monitoring software, and is a far more pleasant language to program in.


Well, you could just copy a bunch of files, if that's all you need to do. But ideally you'd use a tool like Fabric to do your copying/moving, symlinking, server config changes, etc.

We use Python for a number of things too (and yes, I like the language a lot). The only trouble I have with Python in this context is actually cross platform support. It's a bit harder to get packages for the latest and greatest versions of modules and the interpreter if you have to deploy to e.g. Solaris 9 systems, unless you create them yourself. Theoretically it should have the same advantages, yes.


I'm curious: how is testing/testability in PHP different to make it less fun than other languages?


It's not. PHPUnit and dependency injection make it dead easy to mock objects and make testing stupid easy.


Whenever this issue pops up I always imagine Fabien Potencier (while he's no dictator, he has a very clear path) taking over the php source and change it according to his vision. Then I imagine going back to the first php script I ever wrote and how if I would have been able to create it with the changes. I can honestly say I can imagine it would have been a lot harder to do and there is a big chance that I would have given up because I can imagine him going into full OO mode. Don't think I don't like Fabien, for me personally his php version would probably be a lot better, but also a lot harder for new users.

This is one of the best things of php: it's easy enough for new developers and you can grow into the OO aspects of it. While I must admit I would also like a big cleanup to make the function names and arguments more uniform, I don't hope they change anything that makes it harder to begin with php or limit the possibilities to grow.


Some of the statements there such as this really disappoint me.

"PHP is what people use to get their first site off the ground. PHP is what a web designer learns when he/she wants to go into programming. PHP is what a random Joe uses when he needs to whip up a page and he's in "do it yourself" mind."

PHP is a great language in that its very flexible and quick to get going with, the sad thing is people don't want it to grow up...after all, so many massive companies (FB?) use PHP for core components. Why can't those internally have a slightly larger vision...


Facebook hates PHP, but it would be too expensive to convert their 3 million lines of code. They just use HipHop to compile it to C++.


A totally reasonable reply (kind of expected someone to say it!) but the fact that they use php (despite the use of HipHop, which is a wonderful innovation) does say something about the language.

It just makes me sad that rather than saying "look what php can do with some work!" and doing something to head in a direction that could make some of its power uses (like FB) love/like the language, the people in charge simply seem to not care.

A better positioning would be saying something like "php is a great tool to start a web project in, and over time it'll continue to be the best tool to start a project in by helping people innovate even faster." Building it into boxes and decouple it from the rest of the code down the road, like FB have, is likely what most people will do, but at least saying PHP strives to fit this need would be a better vision than saying its for "Joe's weekend website", when clearly that's just shortsighted.

Saying what you're going to do in a public place does increase your chances of following through with it. PHP should document something that says what they want to be, even if its not what some people want them to be!


They are actually phasing out the HPHPc translator and are now developing, as far as I can see, a more conventional one, which translates php into bytecode and can perform JIT on the bytecode into native code without going through C++.


For some reason, people thing "grow up" means "get the feature I think I need today into the core of the language - pronto!". More features, especially more features picked from here and there without consideration of how it plays with the rest of the language, is not "growing up". PHP is adding tons of features lately, but if the author of some proposal does not get what he wants, and now, he starts preaching to anybody who listens that PHP is resistant to change and never wants to grow up. This is just untrue - PHP has grown up long ago, and doesn't really need to justify itself by seeking constant approval of everybody. There are things that are good for it, and things that are not. Things that are good are going to get in, things that are not would hopefully stay out.


It has lots of vision, what it needs is a janitor.


You want a vision? Here is one - make the mess we have at the moment work.

I write in php for the better part of 4 years now and hate it every day. And I have written in c++ before that. Ask 20000 developers what are their main pain grievances sort them by "popularity" and just remove them one by one.

For me it is the hard debugging, the include mess and the "extremely" creative ways parsing and runtime errors are communicated to the developers.


You seriously find PHP hard to debug? I wrote something that may help you : http://jtreminio.com/2012/07/xdebug-and-you-why-you-should-b...

Thanks to namespaces, PSR-0 and Composer, I no longer have to worry about "include mess". Use an autoloader, that's what it's for. If you're finding you have to include a file to access information in it, that tells me you're not testing your code.

The only error I've run across that gave me pause, for a second, was the T PAAMAYIM NEKUDOTAYIM. A quick, 5 second Google search gave me the information I needed.


It's not hard at all, I even created an Xdebug client for OSX to simplify this, www.codebugapp.com


Worthwhile reading the email that preceded it:

http://news.php.net/php.internals/64763

The response hardly seems warranted. The vision is pretty stated there.


The response would seem warranted if you had been a participating member of the PHP internals list for any significant length of time. Stas is pretty well known for jumping into threads and completely derailing, and shooting things down with BS like "PHP is not Java, stop trying to make it into Java". The response is a culmination of a long time of watching him respond in such a fashion.

Stuff like this: http://marc.info/?l=php-internals&m=135083835232016&...

Sometimes he contributes to discussions in a very positive manner. But too often he degrades the discussion into BS rhetoric and greatly demoralizes contributors (I know I am not the only one to voice disdain, I may just be the first publicly)...

I guess you can say I just had enough...


Fair enough, but the only Proven Successful (tm) solution to trolling is to ignore it. If it's not productive, disregard it.


Can't ignore him, he's got a vote in PHP internal.


Now I can understand the state of PHP...


php's internals mailing list is chaos. It's a pantomime of "YES-NO-YES-NO-YES-NO" ad nauseum. And that is why PHP is such a horrible, inconsistent language. It has never had any consistent direction. JS was bad at first, but its mistakes are slowly being corrected and it is become more consistent and coherent. PHP was bad at first, and they keep breaking things as well as improving it.


I think this may be too optimistic. It seems to me that PHP's lack of vision has already made it a horrifically bad language. The problem is not that it tries to do OO while also not really trying to do OO (don't get me wrong though, that is a problem). The problem is that it tries to do OO like Java. Get with the times and learn Ruby already.


it's true, php core devs have some kind of a Java OOP/DP fetish. maybe because they think Java is enterprise so they should replicate what works for them.


I have $20. $10 to two PHP BDFL's kickstarters that are willing to take on the responsibilty of improving the language and removing the inconsistencies.

1) No one from Zend or Rasmus can apply. 2) facebook - would love if you guys forked it, but you don't need my money.


PHP would do well getting proper weak references in play, regardless of vision. No easy task at this point, sadly :(

More specifically: Put in proper weak refs -> get lexical scoping -> get first class functions.


They should hire DHH for 10.000$/day. I'm sure he can help.


Glad i searched before posting exact the same. Don't forget matz in this context...


Switched PHP for JS. Never looked back.

Seriously, It needs to die.


The two are not analogous at all.


Please Explain


So does Perl


it needs a relapse. dont do shit because its popular, do it because its useful!


PHP needs to die

Sorry...


Empty, non-contributing comments like yours that appear in every single thread about PHP on HN need to stop being posted. Not sorry, I mean it. Stop.


It's not an "empty, non-contributing comment" to those of us who have had to use PHP, especially after years of using far better languages. It rings especially true to us who have seen the horror systems implemented in PHP can be.


I feel as though we ought to hold our comments to higher standards than "expresses a strong negative opinion with no supporting evidence or reasoning". Maybe that's just me?

It certainly feels strange that this sort of comment is being defended when the same comment with PHP replaced by Python/Ruby/(Java/Coffee)script/Haskell/C/C++ would be universally reviled.


I don't think that the supporting evidence needs to be explicitly stated. Those of us who have used PHP before inherently know why he posted what he posted. The evidence and reasoning is in our past experience with the language, and it's much stronger than a "citation" of some blog post or anything of that sort.

It's quite telling that we don't see comments like that for other languages that often, if ever. Aside from perhaps JavaScript, no other mainstream programming language causes experienced programmers so much grief. No other language is so riddled with obvious deficiencies, and so problematic.


I hardly think that you and he speak for "those of us who have used PHP before", and to pretend that you do seems awfully arrogant on your part. I definitely don't share your sentiments, that's for sure!

Even if you did speak for everyone who'd used PHP before, I don't think this comment is in any way useful or productive - are we all just supposed to take it on faith that every person who has a strong negative opinion on something speaks for everyone who's familiar with the topic? It seems to me that this is precisely against the spirit of HN (and reasoned discussion in general). So yes, I think that if you're going to make a comment like "PHP needs to die" and want to contribute something meaningful to the discussion, you're expected to elaborate on why you think that way. It's surprising to me that you're even trying to say otherwise.

I'm not sure what to make of your assertion that the existence of a vocal group of PHP haters indicates that "PHP needs to die". I'll admit the language has its warts, but the hatred directed at PHP on HN seems way out of proportion to any other programming community I've been to, and out of proportion to the actual deficiencies with the language. And I don't really think that it makes sense to call PHP a "cancer" or to say that the existence of PHP is a problem; it's not as if we shun and shame programmers when they try to migrate from PHP to other languages, and it's not as if PHP paradigms are "infiltrating" other languages.


I'm one of the "us" you mention, and in fact I'm still working with PHP.

The comment added nothing to the discussion, and was still useless. I'm aware of the drawbacks of PHP. I look forward to a day when I'm no longer using it on a daily basis. But Tichy's comment added nothing to this discussion.


I think it clearly added a lot if it expresses his opinion, my opinion, and apparently even your opinion of PHP in a mere five words.


I admit I only now followed the link to the article, that is how biased I am. Turns out it is an article that basically says "we have no idea how to get out of the mess we created". How much content is in that? I stand by my statement...

Is it not a valid opinion to sometimes say it is time for a thing to die? Why keep investing in hopeless tech?


There is some value in comments like yours. It brings to light just how many of these PHP bashing statements are biased and uninformed knee-jerk reactions, and therefore, should not be taken seriously by any rational person.


How do my comments reveal how informed I am? You know nothing about my experiences with PHP.

Anyway, don't bother - I'll let you own your little PHP discussion now, moving on. My comments on HN won't stop the calamity anyway.


Your original comment revealed nothing. I think that's probably why it was downvoted.


> Why keep investing in hopeless tech?

Because your codebase relies on it.

Death will be hard for any mainstream language (proof: COBOL), especially open source ones.

It might find not many new projects are started in it.


So you would upvote an article about "COBOL needs a new vision" on HN?


I don't think that follows from what he said.


PHP and COBOL both cannot change vision after so many years, that's my whole point.


Questioning the value of a technology which inhabits the technology industry much like a cancer is not empty.

PHP needed a vision 15 years ago. It was originally called "Personal Home Page" and intended to only slightly extend the functionality of Server-Side Includes. People tend to forget that.


> PHP needs to die

That comment is extremely insightful. How did I not see this?

> It was originally called "Personal Home Page"

I was originally 19 inches long and crapped my diaper several times a day. PHP has grown and changed tremendously since those days. It's not the same codebase, at all: "Finding PHP/FI 2.0 still inefficient and lacking features they needed to power an eCommerce application they were developing for a university project, Andi Gutmans and Zeev Suraski of Tel Aviv, Israel, began yet another complete rewrite of the underlying parser in 1997.".


[deleted]


I can't tell if you're trolling or simply ignorant about what the language actually currently is.

PHP4 => PHP5 was a huge change, even more so if you compare PHP3 with PHP5.


Your comment made me curious about it and I see that Tichy has about 15K in karma. If he and a hundred people like him quit HN it would probably fix a lot of what's wrong with it.


This is irrelevant and does not add to the discussion.

Just like Reddit, Karma is not intended to say "my voice has more weight than yours". Karma is a way of letting people know you agree with them, but, just as in a court of law, if you can find one person willing to speak the truth they can stand strong in a house of lies.

Long and short, PHP is going to continue for some time, (just like COBOL, just like assembly) and wishing it was dead is about as effective as a life-savings program subsidized by the Tooth Fairy.


I got curious, too. The last comment you made before this one was this: https://news.ycombinator.com/item?id=5008026

Very constructive :-)


Thank you for posting the exact comment that I wanted to post and taking all the downvotes :-)




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: