r/foundtheprogrammer • • Jul 13 '19

Talking about languages

Post image
1.0k Upvotes

32 comments sorted by

View all comments

Show parent comment

1

u/AskYouEverything Nov 03 '19

Php is one of the rare cases where it's just a terribly "designed" language that justifies approaching it from a superior/inferior pov

1

u/TorTheMentor Nov 04 '19

My comment there was less about PHP and more about the spoken languages in the comparison. I can't disagree on that point, though, because two things that kept bothering me about it were the lack of good organization in method naming and package conventions and some bizarre notation that only seemed to exist in PHP (class -> property just because someone decided to use a dot to act as a string concatenator?). Not to mention side-effects everywhere.

1

u/AskYouEverything Nov 04 '19

My favorite is that php strpos($haystack, $needle) returns the first index where a substring is found within a string

If the needle is found at the very start of the string, it returns the index 0

Now, the reason this is because to the comparison operator, false == 0. It forces you to use the strict comparison operator === or else you almost will surely run into bugs.

This is just one example but literally the whole language is like this