Re: Adding a more logical string slicing function to PHP
| From: | Martin Scotta | Date: | Thu, 31 Mar 2011 17:58:42 +0000 |
| Subject: | Re: Adding a more logical string slicing function to PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51777@lists.php.net to get a copy of this message | ||
I think it's time to stop thinking in terms of "functions" and move forward
to "abstractions"
$s1 = 'string';
$s1->contains($s2);
$s1->indexOf($s2) === strpos($s1, $s2);
Why can't the strings be exposed as pseudo-objects ? users can choose to use
them as a regular strings or by calling methods on it.
Martin Scotta
On Thu, Mar 31, 2011 at 12:52 PM, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
> On 03/31/2011 08:45 AM, Philip Olson wrote:
>
> > - Intuitive name
>
> Argh! Everyone should be forced to learn a bit of C. Like many PHP
> functions, the name and argument order is right out of libc. If you type
> "man strstr" at your (non-Windows) prompt you get a nice little
> description of what it does.
>
> -Rasmus
>