Live data from Hacker News

Ask HN: What's your beef with PHP?

news.ycombinator.com

21–25 of 25 posts

Re: Ask HN: What's your beef with PHP?

#21

If you embrace what PHP is good at, which to me is fast, easy to understand code that is dispatched once per web request in a shared nothing state, PHP is great. When you have to deal with PEAA style PHP, things start to go off the rails in both speed and simplicity. I happen to like PHP's standard lib: it's big and addresses a lot of needs in building web apps. But you don't really see tons of new high quality bindi…

> But you don't really see tons of new high quality bindings or libraries being introduced at the rate that, say, Go is getting them.

While true, this is an apples to oranges comparison. Go libraries, bindings, and extensions are written in Go. PHP bindings and extensions are written in C.

Writing a language extension or library binding in PHP requires an understanding of PHP internals and the C language. Compared to writing a binding or library in Go, this is difficult. It requires the knowledge of 2 languages (instead of 1) and an understanding of how PHP works "under the hood".

However, I think that Zephyr shows promise. It's a high-level language designed for creating PHP extensions, without a direct understanding of PHP internals or C being required. https://zephir-lang.com/ (I just wish it didn't limit you to OO design/implementation.)

Re: Ask HN: What's your beef with PHP?

#22

If you embrace what PHP is good at, which to me is fast, easy to understand code that is dispatched once per web request in a shared nothing state, PHP is great. When you have to deal with PEAA style PHP, things start to go off the rails in both speed and simplicity. I happen to like PHP's standard lib: it's big and addresses a lot of needs in building web apps. But you don't really see tons of new high quality bindi…

I've seen "flamework"-style code go horribly, undeniably bad. But if your goal is "simple and fast and damn the technical debt"-development then I have no qualms with anyone who does it.

Re: Ask HN: What's your beef with PHP?

#23

More than anything else, it's standard library. https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/#...

Mmmmhhh most languages are, more than anything else, their own standard library ... Although there are languages with a very small standard library that are not "batteries included", but they are lower level so it's an apples to oranges comparison.

Re: Ask HN: What's your beef with PHP?

#24
post #13
post #11

Earlier quoted context omitted.

What other languages are you familiar with to compare it too? Because Javascript is in no way well thought out and it doesn't do parallel computing let alone do it right, it's bound to a single core.

I wonder: What in JS ist not well thought. I don't like programming JS, but compared to PHP it has many neat features and ways to get things done. It's just different from other languages. Parallel works. You can even create a deadlock very easy. Also, Node.js can spawn new processes.

Honestly, this has been done to death and it's pretty well accepted that it's not a great, or even good language, so I wont go over it again. It was a language designed in a few days to handle some basic client interactivity and it's good it that, it's just not good at anything more complicated than that, even despite the astronomical amount of effort people have put into working around it's warts.

> Also, Node.js can spawn new processes.

And yet it handles incoming requests on a single process.

Re: Ask HN: What's your beef with PHP?

#25
post #17

Earlier quoted context omitted.

Compared to what?

Compared to almost any other language I've used - it's awkward, and unnecessarily verbose because it mixes in how one would define an associative array/hashmap/object as the only way to use an array. It does not distinguish a traditional list from an associative array.

> how one would define an associative array/hashmap/object as the only way to use an array.

Well JS goes even further in relation to hashmap/object (e.g. you can iterate object properties as if the object was a relational array, because, well, in JS an object is an array). In PHP, on the other hand, you can't refer to $object['property']

Hovever I have to agree with you when it comes to the overlapping between relational arrays vs "simple" arrays, the fact that all arrays are actually relational introduces weirdness, for example sometimes when you replace an array element you end up with elements that are not in the order you expect them to be.

Post reply on HN