Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

> Not many are passionate about the Corolla

But there is also nothing particularly wrong with it. It may not be better, but it has no worse maintenance record, crash record, or accident survival rate then average car. (In software world, that would be perhaps java).

To come with better analogy - PHP is like a 15+ yo car imported from neighbour country because that's the only thing you can afford. Its popular and you'll see it all around in you area, so you may be unaware that better cars even exist. It can be used, but something breaks every 50km, the rust has eaten so much that any minor collision will get you killed, and you'll see people frantically repairing it with duck tape on every street to ever get home. But yeah, you can drive one. And have you heard that next year the tax will be lowered, so you may be able to afford 14 yo cars, life is getting so much better here.



view as:

In fact PHP7 as well as PHP fork called HackLang used in Facebook are brand new cars and the latter even produced in your own country.

Some of the painting is new, but the engine (stdlib) remains the same.

So you are blaming PHP's excellent backward compatibility. Why I am not surprised? :)

I just oppose naming it "brand new". Its largely still just as broken as it always was. Fixing one issue per release will maybe get PHP to state comparable with other languages somewhere in the next century (if they stand still in the meantime).

Also PHP could easily add sane new stdlib if it wanted to, and keep supporting the old one as long as people want to. I just don't think anyone is really interested in doing so. Most PHP users don't care much, and few large companies that fund the work are mainly focused on keeping the ship from sinking.


>I just don't think anyone is really interested in doing so. Most PHP users don't care much

They care. They are interested.

But backwards compatibility is a huge issue. PHP7 is much better, it's faster, it uses less resources, and yet you still have hosts running PHP 5.3, some even running 5.2! How do you combat a crowd like that? I don't want PHP to get stuck in IE6 mode, and I sure hope the community voices their valid criticism and takes action.


> They care. They are interested.

Have they really been, PHP issues would be fixed long time ago. It had 7 major releases, and people complain about exactly the same things. All the people I know who complain about it and switch to something else say the exact same things, no matter what PHP version they've left behind. Those who do care simply go somewhere else, only those who do not or have massive codebase to support stay.

> PHP7 is much better

Lets agree to disagree on that. Its not better enough to draw any of PHP opponents to it.

> you still have hosts running PHP 5.3, some even running 5.2! How do you combat a crowd like that?

You don't. Let them be. There are people using PHP 1,2,3 and 4 somewhere out there. They may never switch. Why should it hold back the rest of the world?

> I don't want PHP to get stuck in IE6 mode

The whole PHP is its own IE6.


Taking into considering that the thing you complained about (errors instead of exceptions) was fixed in PHP 7, maybe you should reevaluate your opinion about PHP not fixing things in newer versions...

"keeping the ship from sinking" - surely you are a borad member for Facebook, Badoo, Dailymotion. I appreciate your first hand evidence.

Come on, if a handful inconsistent function names is all the problem with PHP to you, let me suggest you to get yourself a good IDE with a code completion feature. You'll forget that "broken stdlib" forever... of course if your aim is to get the job jone, not to slander a language you aren't working with.


That they are inconsistent is one problem. That they are functions is another (in otherwise object-oriented language). That they don't throw exceptions is one more (in a laguage that has them). IDE won't fix any of that.

You can make them throw actually.

set_error_handler("myErrorHandler"); function myErrorHandler($errno, $errstr, $errfile, $errline) { throw new Exception($errstr, $errno); }

Is all you need.

They are functions - yes. If your first language was fully OOP, then probably PHP is not your language of choice. It doesn't make it bad, though.


>set_error_handler("myErrorHandler"); function myErrorHandler($errno, $errstr, $errfile, $errline) { throw new Exception($errstr, $errno); } Is all you need.

So you think boxing all kinds of errors into one generic exception type is a solution to this shortcoming of the language?

That sure feels like a 'php' solution. I will give you that. But that ain't pretty (even as a work around), and no, it does not do the job. May be if you don't know how to work with exceptions in the first place, then it might work for you. But you might end up with a code base like this [1]

[1] http://stackoverflow.com/questions/3425835/converting-errors...


This will most likely break a lot of existing code. Even if it works, it means I'll be parsing text to figure out what exactly happened (exception not only signal "that something happended", but also "what exactly happened". In languages that use them properly that is). Third, nobody does it. Most importantly, stdlib doesn't do it. All of does make PHP bad for me.

It it will break BC, then don't use it? You guys are using every dirty trick invented for internet discussions in the last 30 years. You said it dosen't exist. When I showed the way to get it, the agrument should stop this very instant.

Instead you started nitpicking on the solution. That's dishonest. And it makes the discussion endless.

> Third, nobody does it.

This statement of yours clearly states that you have no idea of the actual PHP ecosystem. Every single major PHP framework is routinely doing it.


> It it will break BC, then don't use it?

So the choice is between insane behaviour, or breaking the code.

> Instead you started nitpicking on the solution. That's dishonest. And it makes the discussion endless.

Because the problem is unsolvable. You cannot get PHP to behave sanely unless you redo everything it does. If you fix one thing, dozens of other will fall apart.

>Every single major PHP framework is routinely doing it.

Right, I wasn't aware of this. How do you write libraries for PHP than, you choose between using what's in stdlib as it is and being used within a framework where exceptions are thrown? Support both? Ignore the problem? Or every library makes its own choice how stdlib should behave? Do the frameworks convert strerr and errno into something usable?


You do realize that they do throw Exceptions?

Welcome to PHP 7


You're right, if you enforce it via set_error_handler they do, otherwise they don't. Congratulation for PHP team, they are slowly getting on par with methodology invented in 60's. Any plans for having usable exception hierarchy like every other OOP language with exceptions so that you can actually make some use of them?

>Come on, if a handful inconsistent function names is all the problem with PHP..

I don't know about OP. But it is not just that. Php is a flawed language to its roots. Just think of the community that has tolerated a feature like register_globals for, I don't know, 15 years?

What good can you expect from it?


Facebook and Wikipedia?

What? No. Just because they were written in Php does not mean that they only exists because of Php. That is more than ridiculous...

Also, that was not the question, at all.


Classic phptard argument.

but hey, I'm a php hater, don't mind me, retard


We've banned this account for continuing to violate the guidelines after we asked you to stop. We're happy to unban accounts if you email hn@ycombinator.com and we believe you'll not do this any more.

Haha! That analogy works so well. Especially when you consider the Bondo-esque way in which higher-level language constructs have been ... well, bondo-ed on to the language.

>> PHP is like a 15+ yo car imported from neighbour country

What about Python ?


Car of the year from 2015. Not the shiniest toy anymore, but has everything you may need and you can get very good deal on it.

Except it doesn't have type hinting. Which is something you definitely need if you want to write good OOP software as described by the literature (Clean Code, Code Complete, Effective Java etc).

Type hinting is not exactly there yet, but its coming. You can already write:

def foo(x:int) -> int: return x+1

to get hints in your IDE (though its not enforced yet by interpreter).


Legal | privacy