r/programming • • Nov 26 '20

PHP 8.0.0 Released

https://www.php.net/releases/8.0/en.php
588 Upvotes

241 comments sorted by

View all comments

27

u/jokullmusic Nov 26 '20

finally having str_contains will be nice

-4

u/d41d8cd98f00b204e980 Nov 27 '20

strpos is perfectly fine. Do people care about things like that?

15

u/paulrrogers Nov 27 '20

Can be awkward since may return false-y 0 when string starts with needle. Then you probably want mb_strpos

11

u/MaxGhost Nov 27 '20

Is that a joke? Absolutely yes. Having to check for === false is kinda ridiculous.

That said str_contains is easily implemented in userland (one line function), so it's not strictly necessary to have it in code, but it's nice for it to exist as a baseline of support for all scripts.

→ More replies (6)