Hacker News new | past | comments | ask | show | jobs | submit login

I'm a fan of PHP and have been for years for several reasons:

1. Low barrier to entry;

2. Hard to leak resources since the model is to tear down everything after a request finishes;

3. Stateless API core which means the efforts of creating an environment for a request for (2) is extremely low. Compare this to, say, the bootstrap time for Python or Java (which is why those generally don't follow the request teardown model);

4. Almost no multithreading.

This makes it great for servicing HTTP requests IMHO.

I need to compare it to Hack/HHVM though since I used that for years and it's still playing catch up with features Hack has had for years eg:

1. Hack has had the async-await model for years;

2. The type system is actually really good. It made me appreciate how nullability being part of the type system is incredibly useful. Plus it's had generics for years; and

3. Better inbuilt collection types with less odd coercion behaviour (ie dict, keyset, vec).

I find PHP hate in 2022 to be tired. Look at something like Laravel and PHP is completely fine. The sins of the past and even the odd inconsistencies still left in the language (eg needle and haystack param ordering) don't really matter.




> Compare this to, say, the bootstrap time for Python or Java

The bootstrap time for a request exists only in a web framework, not in the language. And since you can have the extremes of pure fastcgi or uwsgi, or full Django, you need a more specific comparison.


Java has a high bootstrap time for the JVM. PHP doesn't have that, but the "tear down everything" model might imply a high bootstrap time depending on the framework, because things need to be bootstrapped per request that are already there in Java.


Regarding bootstrap time, have you tried cold PHP, like a cgi script or a PHP script run from shell? Not fast at all. I guess you are comparing PHP with mod_php (or something similar that already has a running interpreter in memory). In that case, it would be fair to compare it against something with JVM in memory, like Tomcat or Jetty.


It seems that PHP (or at least the community) is taking a lot of inspiration from hack for its newer additions, and giving very little in the way of credit or comparisons.

It is weird than an article like this shows nothing for ctrl+f "hack"


I think the problem of PHP is the amount of old tutorials/solutions/conventions/etc. Maybe this is the direction all languages take. Eventually the only way to separate yourself from the past is to sever the name link so as to remove the confusion when trying to learn the modern way of interfacing with the language.

Having used Laravel I did feel that was the best version of PHP I had ever used, which while great, each time I use it, I still feel encumbered. It could just be the workflows that PHP provides don’t/haven’t meshed well with the type of endeavors I’ve tried to approach. Or maybe the language just carries too much history.

As an undergrad I made the mistake of attempting to use php solve some bioinformatics homework and ended up reimplementing the k-means algorithm. While that example may be more revealing of my ineptitude for data science it broaches the topic of “where does a language provide the right primitives for the work at hand?” And if the web is changing, is it still appropriate to use a language designed around a previous version of the web?


I agree that PHP hate is pretty boring. Nothing beats being able to FTP a few files to deploy a simple dynamic webpage. I still use it for that. But when it comes to building large web apps, I moved on years ago. While I have seen there have been a ton of improvements with some really nice frameworks, there is nothing so crazy innovating about any of it that would make me care to switch back.




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

Search: