[RFC] [DISCUSSION] str_contains

php.internals

Philipp Tanlak

6 years ago
Hey PHP Devs! Since the RFC to str_contains is now almost a week old and most of the discussion happened in the initial discussion/proposal thread, I wasn't sure if everyone has seen it. Therefore I'd like to create this new email thread with the correct label for RFC discussions, before we open up the RFC for voting in approximately a week from now. If there is any feedback or something you'd like to discuss, feel free to leave it here. Link to RFC: https://wiki.php.net/rfc/str_contains Regards Philipp

Ben Ramsey

6 years ago
> On Feb 23, 2020, at 03:12, Philipp Tanlak <philipp.tanlak@gmail.com> wrote: > > Hey PHP Devs! > > Since the RFC to str_contains is now almost a week old and most of the > discussion happened in the initial discussion/proposal thread, I wasn't > sure if everyone has seen it. Therefore I'd like to create this new email > thread with the correct label for RFC discussions, before we open up the > RFC for voting in approximately a week from now. > > If there is any feedback or something you'd like to discuss, feel free to > leave it here. > > Link to RFC: https://wiki.php.net/rfc/str_contains > > Regards > Philipp
Just so I’m clear on the functionality here, is this essentially the same behavior as the following? strpos($haystack, $needle) !== false And the purpose is primarily for a better developer experience by reducing confusion through providing a dedicated function for this behavior? Cheers, Ben

Philipp Tanlak

6 years ago
Ben Ramsey <ben@benramsey.com> schrieb am Mo. 24. Feb. 2020 um 17:21:
> > On Feb 23, 2020, at 03:12, Philipp Tanlak <philipp.tanlak@gmail.com> > wrote: > > > > Hey PHP Devs! > > > > Since the RFC to str_contains is now almost a week old and most of the > > discussion happened in the initial discussion/proposal thread, I wasn't > > sure if everyone has seen it. Therefore I'd like to create this new email > > thread with the correct label for RFC discussions, before we open up the > > RFC for voting in approximately a week from now. > > > > If there is any feedback or something you'd like to discuss, feel free to > > leave it here. > > > > Link to RFC: https://wiki.php.net/rfc/str_contains > > > > Regards > > Philipp > > > Just so I’m clear on the functionality here, is this essentially the same > behavior as the following? > > > strpos($haystack, $needle) !== false > > > And the purpose is primarily for a better developer experience by reducing > confusion through providing a dedicated function for this behavior? > > Cheers, > Ben >
Yes, this is correct. Regards Philipp

Ben Ramsey

6 years ago
> On Feb 24, 2020, at 10:52, Philipp Tanlak <philipp.tanlak@gmail.com> wrote: > >> Ben Ramsey <ben@benramsey.com> schrieb am Mo. 24. Feb. 2020 um 17:21: >> > On Feb 23, 2020, at 03:12, Philipp Tanlak <philipp.tanlak@gmail.com> wrote: >> > >> > Hey PHP Devs! >> > >> > Since the RFC to str_contains is now almost a week old and most of the >> > discussion happened in the initial discussion/proposal thread, I wasn't >> > sure if everyone has seen it. Therefore I'd like to create this new email >> > thread with the correct label for RFC discussions, before we open up the >> > RFC for voting in approximately a week from now. >> > >> > If there is any feedback or something you'd like to discuss, feel free to >> > leave it here. >> > >> > Link to RFC: https://wiki.php.net/rfc/str_contains >> > >> > Regards >> > Philipp >> >> >> Just so I’m clear on the functionality here, is this essentially the same behavior as the following? >> >> >> strpos($haystack, $needle) !== false >> >> >> And the purpose is primarily for a better developer experience by reducing confusion through providing a dedicated function for this behavior? > > Yes, this is correct.
As an effort to improve developer experience, I’m on board with this. I think it make sense to add this. Cheers, Ben

Larry Garfield

6 years ago
On Mon, Feb 24, 2020, at 10:56 AM, Ben Ramsey wrote:
> > On Feb 24, 2020, at 10:52, Philipp Tanlak <philipp.tanlak@gmail.com> wrote: > > > >> Ben Ramsey <ben@benramsey.com> schrieb am Mo. 24. Feb. 2020 um 17:21: > >> > On Feb 23, 2020, at 03:12, Philipp Tanlak <philipp.tanlak@gmail.com> wrote: > >> > > >> > Hey PHP Devs! > >> > > >> > Since the RFC to str_contains is now almost a week old and most of the > >> > discussion happened in the initial discussion/proposal thread, I wasn't > >> > sure if everyone has seen it. Therefore I'd like to create this new email > >> > thread with the correct label for RFC discussions, before we open up the > >> > RFC for voting in approximately a week from now. > >> > > >> > If there is any feedback or something you'd like to discuss, feel free to > >> > leave it here. > >> > > >> > Link to RFC: https://wiki.php.net/rfc/str_contains > >> > > >> > Regards > >> > Philipp > >> > >> > >> Just so I’m clear on the functionality here, is this essentially the same behavior as the following? > >> > >> > >> strpos($haystack, $needle) !== false > >> > >> > >> And the purpose is primarily for a better developer experience by reducing confusion through providing a dedicated function for this behavior? > > > > Yes, this is correct. > > > As an effort to improve developer experience, I’m on board with this. I > think it make sense to add this. > > Cheers, > Ben
I fully support this as well. It's a common source of subtle bugs, and a minor change to the standard library can eliminate a major PHP WTF. --Larry Garfield