Re: Re: [VOTE] Voting opens for str_starts_with and ends_with functions
| From: | Claude Pache | Date: | Mon, 08 Jul 2019 13:53:47 +0000 |
| Subject: | Re: Re: [VOTE] Voting opens for str_starts_with and ends_with functions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106172@lists.php.net to get a copy of this message | ||
> Le 8 juil. 2019 à 15:20, Christoph M. Becker <cmbecker69@gmx.de> a écrit :
>
> FTR, there is already substr_compare().
substr_compare() (as well as strncmp() which I am currently using in lieu
of str_starts_with()) forces you to provides the substring and the length of the
substring, instead of just the substring:
substr_compare('foobarbaz', 'foo', 0, 3) === 0
strncmp('foobarbaz', 'foo', 3) === 0
str_starts_with('foobarbaz', 'foo')
—Claude