Live data from Hacker News

In many ways PHP is just now starting to come into its own

gist.github.com

111–120 of 133 posts

Re: In many ways PHP is just now starting to come into its own

#111
post #2

While it's certainly true that PHP is better than it was 7 years ago, that is primarily in the ecosystem and not the language. The language remains as bad as it was 7 years ago, and they seem to be woefully unwilling to actually fix it.

A fixed php would be a different language. The differences between Python 2.x and 3.0 would be minor compared to what would need to be fixed in php... and look how well that migration has worked out for python.

It has worked just fine for Python, now. Maybe your impressions of how well it went were set in 2010 and not revisited?

Re: In many ways PHP is just now starting to come into its own

#112
post #110
post #38

Earlier quoted context omitted.

Not really. That only works with one host, whereas PHP works with just about any 5 dollar/month host in the world.

For loose definitions of 'works'

No. It works as well in one place as in any other.

Re: In many ways PHP is just now starting to come into its own

#113

Earlier quoted context omitted.

Well that's why I said "even" Javascript. Brendan Eich actually pulled off a small miracle by embedding incredibly powerful functional and prototypal paradigms in JS. It's not perfect, and there are plenty of warts, but JS came out of the gate with a powerful core that PHP took decades to add in a Frankenstein manner.

Enough with the "JavaScript is a functional language" myth, please. Merely having first-class functions does not make a language a functional programming language. JavaScript does not promote the use of pure functions, referential transparency, and the minimization of state. JavaScript does not encourage the use of recursion. JavaScript has an atrociously broken type system, rather than a robust and theoretically sou…

JavaScript's design is clearly much more coherent than PHP's. Whereas PHP's developers have added features haphazardly over several years, the JavaScript language hasn't changed much since its initial design in 1995. Warts aside, having a (barely) complete initial design that was done by one person over a short time and has since been mostly left alone is an advantage. And JavaScript is flexible enough that library and framework developers have been able to explore several different approaches while the language remains frozen. Therefore, it's quite misguided to lump JavaScript in with PHP in terms of language design.

It's certainly not accurate to categorize JS as a functional language, but it is flexible enough that one can program in a more or less functional style; and unlike PHP, it always has been.

Also, I've read several of your anti-JS diatribes, and I feel compelled to ask this: What drives you to denigrate JavaScript, and programmers who willingly choose to use it, wherever you can? Do you feel the need to show your superiority by bashing the languages that many programmers use to produce useful applications despite their lack of expertise? Can we not accept that all mainstream languages have warts, and that in many cases, practicality may dictate that we use a language that doesn't please us aesthetically but is nevertheless useful?

Re: In many ways PHP is just now starting to come into its own

#114

PHP is like that old phillips screwdriver you have in your toolbox. You know, the one with a crack going down the side of the handle. Wrapped in masking tape to keep the thing together. You bought it when you moved into your first house and you need to screw a lighting fixture that was about to fall off the wall. It's been with you for years, always there in case something needed a little tightening. Sure you have be…

Reminds me of this glorious quote from http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...:

"I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.

You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.

You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.

Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.

That’s what’s wrong with PHP."

Re: In many ways PHP is just now starting to come into its own

#115
post #93

Earlier quoted context omitted.

Not so fast. PHP evolved a lot as a language, maybe it will never be enough to fix its ancestry, but namespaces, closures, generators, ~~typed~~ expressions (you can finally slice a function call returning an array without unnecessary variables) and some literals. It's still not 1958-worthy to me, but they do evolve.

It is evolved indeed, but is there any language designer / guru who ever come close to exploring its good parts (like Douglas Crockford did with Javascript)? I don't think so...

Well, first I think it's irrelevant with what we were saying. Secondly, I doubt there will ever be such a document toward PHP, since it wasn't conceived with a linguistic background (Rasmus Lerdorf wanted a pragmatic dynamic layer on top of C code without resorting to perl). There's no special abstraction principle in PHP, as opposed to prototyping, which (after a quick wikicheck) is not a core abstraction in mainstream languages and could benefit from a book explaining how to think in it. PHP is more and more aiming toward mainstream class based OOP, and everything has been said about it but I can be wrong.

Re: In many ways PHP is just now starting to come into its own

#117
post #3

"Jeff Atwood has stated publicly that one of his ulterior motives with the Discourse project is get people to stop using PHP and start using Ruby." This just won't ever happen. The people that wanted to drop PHP for something else (Ruby, etc) largely did so years ago. The hosting/running situation for PHP is just too basic and easy for people to get in to vs having to 'run a server' (Rails, etc). PHP is still the onl…

I think node can beat out php in regards of ease of hosting. I've simply never worked with a version or package manager that works as well as nvm and npm. Trying to do the same thing with Ruby or Python is like pulling teeth. Even compared to PHP it's a breeze. I know it isn't on all hosting solutions like PHP, but Heroku and Nodejitsu are free for small or open source projects respectively.

But you're right, PHP assuming HTML output by default is a huge boon. With node you have to set up your own server and routes, and more... That's a lot more work than installing WAMP, running it, and putting your php files in the right folder.

Re: In many ways PHP is just now starting to come into its own

#118
post #116

Can anyone recommend a good PHP framework? I've used Zend and Yii - they are okay, but I'd like to try something new. So, other than these two, which ones are good?

Laravel 4 http://laravel.io for large dependency heavy projects,

Slim Framework http://slimframework.com as a microframework.

Re: In many ways PHP is just now starting to come into its own

#119

The thing that irritates me the most with Php, is not being able to quickly jump around the code from class to class without some hack. While magic autoloaders are great my IDE/text editor isn't smart enough to know how to do this. You could probably write some code to help in this respect for your editor or use some other tools. It ultimately ends up that I want to hold too much of the project in my head, which is a…

I would suggest that this in particular is a problem with your workflow and IDE/editor and not PHP. I've usually just kept everything open as a project in Sublime Text, works just fine. As far as the code itself goes, using PSR-0 and/or Composer makes most of the headaches with class loading just go away.

Re: In many ways PHP is just now starting to come into its own

#120
post #119

The thing that irritates me the most with Php, is not being able to quickly jump around the code from class to class without some hack. While magic autoloaders are great my IDE/text editor isn't smart enough to know how to do this. You could probably write some code to help in this respect for your editor or use some other tools. It ultimately ends up that I want to hold too much of the project in my head, which is a…

I would suggest that this in particular is a problem with your workflow and IDE/editor and not PHP. I've usually just kept everything open as a project in Sublime Text, works just fine. As far as the code itself goes, using PSR-0 and/or Composer makes most of the headaches with class loading just go away.

I agree about that PSR-0 and using Composer helps. But sadly not all code is written that way.
Post reply on HN