this post was submitted on 30 Oct 2023
976 points (96.1% liked)

Programmer Humor

31214 readers
1168 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] lankybiker 67 points 8 months ago (5 children)

PHP is amazing

If you're thinking of PHP version less than 8 you need to have another look

Totally stateless. Uncached server side rendered response times in double digit milliseconds.

Types

Extremely battle, highly tested frameworks.

Excellent tooling for tdd, bdd, static analysis, automated browser testing, coding standards and auto fixing. Even fully automated refactoring for things like package upgrades (Rector)

Regular, solid, releases bringing updates and fixes

Arguably one of the best package management systems, Composer. And only one, none of this constantly changing tooling that some other ecosystems seem to do

Properly open source platforms to power all kinds of web projects from e-commerce, CRM, social, scraping, analytics, monitoring, API, CMS, blogging

Basically if your target is server side web stuff then it's really good

Or, you can continue to demonstrate how out of touch you are by continuing with the old "PHP bad" jokes if you want!

[–] [email protected] 20 points 8 months ago (2 children)

Uncached server side rendered response times in double digit milliseconds.

Thirst thought, that sounds slow. But for the use case of delivering html over the Internet it is fast enough.

[–] moriquende 16 points 8 months ago

Get this man some water.

[–] [email protected] 3 points 8 months ago (1 children)

Double digit milliseconds sounds slow to you?

[–] [email protected] 4 points 8 months ago (2 children)

For a bit of templating? Yes! What drives response times up is typically the database or some RPC, both of which are out of control of PHP, so I assume these were not factored in (because PHP can't win anything there in a comparison).

[–] [email protected] 4 points 8 months ago (1 children)

Anything under like 100ms load is instant to the user, especially a page load. It's a balancing act of developer experience vs performance. To split hairs over milliseconds seems inconsequential to me. I mean, PHP requires $ before variables! That's the real controversy :p

[–] [email protected] 4 points 8 months ago

Anything under like 100ms load is instant to the user, especially a page load.

True, but it accumulates. Every ms I save on templating I can "waste" on I/O, DB, upstream service calls, etc.

[–] jaybone -1 points 8 months ago (1 children)

If it’s stateless and nothing is kept in memory, can you have a connection pool?

[–] [email protected] 0 points 8 months ago

If you run it in old-school CGI mode, no, because each request would spawn a new process. But that's nowhere near state-of-the-art. So typically you would still have a long-running process somewhere that could manage a connection pool. No idea if it does, though. Can't imagine that it wouldn't, however, since PHP would be slaughtered in benchmarks if there was no way to keep connections (or pools) open across requests.

[–] [email protected] 3 points 8 months ago (3 children)

not only that but you just install it with the lamp stack setting in ubuntu tasksel with apache and mariadb. the beating that these can take (except maybe the sql) and survive is great. you also have access to the whole of linux to do more advanced stuff, while other languages/ stacks shy away from exec

[–] [email protected] 7 points 8 months ago (1 children)

other languages/ stacks shy away from exec

I’m sorry, what?

[–] [email protected] 10 points 8 months ago (1 children)

Turns out arbitrary code execution is actually great(!)

[–] [email protected] 2 points 8 months ago (1 children)

it does not have to be arbitrary my dude

[–] [email protected] 2 points 8 months ago (1 children)

Problem is, you’re mixing a number of different concepts into a nonsensical claim.

Exec as an “execute a string as a language instructions” is nothing new nor unique to PHP. Ruby on Rails, for example, uses it in a controlled manner to generate methods on ActiveRecord models.

Exec as an “replace this process with another process” is old news again. It’s not even language specific.

Popen/spawn family (which seems to be what you alluded to) is, once again, nothing new and is used everywhere.

[–] [email protected] -1 points 8 months ago

i just meant that python's and node's implementation is shit

[–] TheBeege 3 points 8 months ago* (last edited 8 months ago)

All of that can be the same as other stacks except the Apache bit. You can stand up a Go application on Ubuntu hitting MariaDB as its persistence layer. Or Python. Or Node. Or Java. Or even Ruby. Shit, Haskell can do it.

~~Also, exec is a code smell. Arbitrary code execution is a massive security risk, and the effort to mitigate that risk is often less than explicitly building out the required functionality.~~

I think you need to explore more technologies, my friend. And read up on some security things

Edit: I now realize you mean exec as in calling out to a shell. All languages have this. Still, the overhead of spawning and managing a new process is often more than just implementing the logic in your application itself.

[–] [email protected] 1 points 8 months ago

I personally prefer hestiaCP but yes

[–] [email protected] 2 points 8 months ago

Extremely strong functional programmer support, too!

[–] [email protected] 1 points 8 months ago

On the note of testing, Pest is still one of the best testing options I’ve seen across a variety of langs.

[–] [email protected] 1 points 8 months ago (3 children)

What’s wrong with version 8?

[–] [email protected] 25 points 8 months ago (1 children)

Dude was saying that 8 is good, but people still think of version 5 when talking about PHP. Not recommended to still use in 2023.

[–] [email protected] 5 points 8 months ago (1 children)

Even 5.3 was good enough.

4 was hilariously bad though

[–] [email protected] 1 points 8 months ago

I'd say 5.4 was when it publicly got great - but yea, a lot of ground work for that was in 5.2/5.3

[–] [email protected] 2 points 8 months ago

he meant 8 is great

[–] [email protected] 1 points 8 months ago

On the opposite - version 8 is great.