Re: Built-in function: between
| From: | Philip Olson | Date: | Thu, 30 Sep 2010 15:59:26 +0000 |
| Subject: | Re: Built-in function: between | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49824@lists.php.net to get a copy of this message | ||
On Sep 30, 2010, at 7:14 AM, Johannes Schlüter wrote:
> On Thu, 2010-09-30 at 16:37 +0300, Adi Nita wrote:
>> Perhaps a better idea would be to group the ones that we already have
>> under a common namespace. But this is no news, though.
>
> Even then it would be unlikely that we add another special purpose
> function. This would have to be an important feature, ringing huge
> improvements in performance versus existing solutions (like preg_math)
I can see (and always wish for) in_string() existing, but that's more for naming reasons.
Choosing strpos() or strstr() or some other random string function for this common task feels dirty.
Imagine if we had to use arrpos() instead of in_array() ;) Also, since strpos() is our official
method, we must worry about 0 == false.
Sorry for hijacking this thread, but it feels related.
As for between(), creating a cookbook of common tasks (and inserting them into the manual) sounds
reasonable. For example, we did something like this for the plethora of array sorting functions:
http://php.net/array.sorting
Regards,
Philip