Live data from Hacker News

PHP needs to die. What will replace it?

seldo.com

91–100 of 160 posts

Re: PHP needs to die. What will replace it?

#91
post #77
post #72

To replace PHP you need: 1. To be on all shared hosting everywhere. I.e. you need to be really easy to install, and preferably not involve long-running processes that shared hosts might choke on. 2. To be beginner friendly. No requirement of understanding MVC, or running commands in a shell (hi RoR!). Pure instant gratification. Someone's first step into using PHP is likely going to be "I want the current date in the…

Yeah, exactly. This headline could have been written with the same justification in 1999. Yet PHP refuses to die. Clearly us hackers are missing something important.

Having not used php for 12 years, I recently accepted a freelance job for a client who had been left in the lurch by his php developer who seemingly abandoned the project because she was out of her depth.

I have to say that I was pleasantly surprised by some of the new language features that php has borrowed from elsewhere... eg: closures, anonymous functions, docstrings.

IMHO php is held back primarily by messy, inconsistent documentation and extremely ugly parts of the core library that are also riddled with inconsistencies that should have been deprecated years ago.

Not that I would consider starting a new project in php - I just love programming too much for that; but I believe php will evolve, benefiting from other languages.

Really, it needs it's own "Python 3" (out with the old, smarten up the new).

Re: PHP needs to die. What will replace it?

#92
post #37

Earlier quoted context omitted.

If you have unlimited hardware at your disposal, work on projects where a slightly faster development for certain, specific cases can be obtained, or work on projects of a size that can be managed by the performance of a single machine, sure. If not, R/R isn't replacing PHP.

Rails doesn't really need that much hardware, that's a very common misconception. PHP is not the fastest thing in the world either, unless you go with a compilation cache server. Rails can be easily perform well under single machines. I have VMs with 512Mb of ram handling thousands of users per day with Rails with no problem.

Of course, it's not like a modern first person shooter or anything. My point was that on one and the same machine, PHP gets a whole lot more done per portion of computer power than Ruby does :)

Re: PHP needs to die. What will replace it?

#93
post #47

Earlier quoted context omitted.

PHP is not that bad? What other popular language is worse?

Lua and JS both come to mind. Neither of them are worse than PHP, but they're right around that same level of (un)usability and number of pitfalls.

Lua, really? Could you provide some examples?

Re: PHP needs to die. What will replace it?

#94
I get that PHP is not the most elegant language in the World (see kemayo's comment about strpos and in_array for just one example), but I don't understand why people get so worked up over the fact that people use it.

It seems like you can't mention PHP without people inferring that you're a lesser programmer or that you clearly don't know what you're doing.

Re: PHP needs to die. What will replace it?

#96
post #93

Earlier quoted context omitted.

Lua and JS both come to mind. Neither of them are worse than PHP, but they're right around that same level of (un)usability and number of pitfalls.

Lua, really? Could you provide some examples?

No basic string manipulation, only RE-based stuff.

One-based indices instead of zero-based.

Re: PHP needs to die. What will replace it?

#97
post #82
post #68

Earlier quoted context omitted.

When I read >> the critical thing Perl was lacking was PHP's wonderfully flexible "associative arrays" I grabbed my copy of "Learning Perl" from 1997. Chapter 5's topic? Hashes.

Perl hashes don't preserve order. PHP's almost always do. i.e., the order you insert keys is the order in which you will receive them back when you iterate over the array. It's similar to a LinkedHashMap in Java. CS types might recoil at the mixture of behaviors that are baked into PHP's workhorse data structure, but most of them turn out to be quite useful. (And it makes it easier for the beginner programmer to deci…

There is CPAN for that. (iirc, this is solved with a module in the Perl Cookbook. I don't have that book where I am writing this.)

Edit: For a beginner that wants a Visual Basic for web, sure. By now I have different needs, to enjoy using my tools. (And for the record, if I need to keep order of a hash/dict/etc in some language, I generally use a "traditional" array in addition. That is probably too complex for a beginner? :-) )

Edit 2: I'm not dumping on PHP, it is a useful tool for many people. I just wish the development of the language had been handled a bit more carefully.

Re: PHP needs to die. What will replace it?

#98
post #86
post #40

Earlier quoted context omitted.

I take it you have never tried to get major changes to core server infrastructure approved at large bureaucratic institutions. Writing your code in php is often orders of magnitudes faster, easier and cheaper than getting a decent RoR setup installed.

That's your experience, and highly subjective. And yes, I deploy code to dozens of enterprise servers for a global company. And that company is looking into Rails, not PHP.

Looking into rails? What are they using currently?

Re: PHP needs to die. What will replace it?

#99
post #84
post #80

Earlier quoted context omitted.

Are you saying that developing an API in PHP is insane?

No, I'm saying that the stuff built into PHP is weird and inconsistent. I should change it to "sane default library" from "sane API". My current favorite example of this (ignoring the naming scheme for string functions entirely) is that in_array and strpos are functions that perform (almost) the same task, on two different types. They take their arguments in the opposite order. strpos($haystack, $needle) vs in_array(…

> No, I'm saying that the stuff built into PHP is weird and inconsistent.

You never asked yourself WHY. See, that's the important question, isn't it. WHY.

I'll tell you WHY. Because two different dudes implemented it. At different times. Probably, from different continents. They didn't notice it at the time.

But, eventually, someone noticed it. And then they did something really crazy. They didn't fix it. Because that would break the software already using those functions.

It's impossible to write a perfect language from the start. Hell, it's not possible to write a good language from the start. Things that you didn't see crop up and you have to add functionality. And sometimes, the way you added it isn't right ... at that point, you have two choices.

You can fuck your existing user-base up the ass, refactor your code, change the interface, and do it "right" ... or you can do everything you can to mitigate the damage, while keeping the interface the same.

I can pull up software I wrote 10 years ago and it'll still work. Perfectly. You can only say that about languages that do it right.

And guess what? Those languages, they always have lots of warts. Because someone made the hard choice and kept something that's ugly, instead of fucking over a shitload of people to make it pretty.

I'll take function over form any day.

Post reply on HN