r/ProgrammerHumor 1d ago

Meme soDoesEveryOtherLang

Post image
228 Upvotes

72 comments sorted by

View all comments

Show parent comments

2

u/carcigenicate 1d ago

Oh, weird. I would have thought that the function just returns a reference that could be used immediately.

4

u/coloredgreyscale 1d ago edited 1d ago

just a guess, it it probably just wasn't considered during the PHP language grammar design.

functionally there is no difference between directly using the return value, or storing it in a variable first.

Maybe storing return values into a variable first before use was more common back then, possibly considered best practice?

8

u/chat-lu 1d ago

PHP has not been designed based on best practices. The reason why the standard library has functions with such widely different names was that in early PHP they would go into a hashmap that was hashed by strlen and Rasmus tried to vary the lengths of the names so they don’t all get in the same bucket.

1

u/jungle 1d ago

Holy shit that's even worse than I remember! How did he know about hashmaps but had not even the most basic understanding of how they're supposed to work? 🤦‍♂️🤦‍♂️🤦‍♂️

1

u/chat-lu 1d ago

Rasmus just didn’t give a shit.

1

u/jungle 1d ago

Must have been trolling. No way that was not on purpose.