Re: [PHP-DEV] Adding a more logical string slicing function to PHP

2011-04-02 Thread Stan Vass
Looking at JavaScript which acts quite similarly to the proposed approach, the Number methods [1] are not many and not often useful, but still they exist. What happens if you do "3.3"->ceil() ? If ceil() exists only in \numeric, you could say autoconvert, but if it exists in both \string and \nume

Re: [PHP-DEV] Adding a more logical string slicing function to PHP

2011-04-02 Thread Jacob Oettinger
On Apr 2, 2011, at 15:24 , Jordi Boggiano wrote: > On Sat, Apr 2, 2011 at 1:38 PM, Jacob Oettinger wrote: >> On Mar 31, 2011, at 21:10 , Rasmus Lerdorf wrote: >> >>> On 03/31/2011 10:58 AM, Martin Scotta wrote: I think it's time to stop thinking in terms of "functions" and move forward

Re: [PHP-DEV] Adding a more logical string slicing function to PHP

2011-04-02 Thread Martin Scotta
On Sat, Apr 2, 2011 at 12:41 PM, Stan Vass wrote: > This is actually something I have been toying with a bit. Adding the >> ability to call methods on both strings and arrays. I still don't like >> the idea of making them real objects as the overhead and the amount of >> code that would need to b

Re: [PHP-DEV] Adding a more logical string slicing function to PHP

2011-04-02 Thread Stan Vass
This is actually something I have been toying with a bit. Adding the ability to call methods on both strings and arrays. I still don't like the idea of making them real objects as the overhead and the amount of code that would need to be changed in the core and in every extension is daunting. Anyb

Re: [PHP-DEV] Adding a more logical string slicing function to PHP

2011-04-02 Thread Pas
On 2011.04.02. 13:38, Jacob Oettinger wrote: On Mar 31, 2011, at 21:10 , Rasmus Lerdorf wrote: On 03/31/2011 10:58 AM, Martin Scotta wrote: 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) ===

Re: [PHP-DEV] Adding a more logical string slicing function to PHP

2011-04-02 Thread Jordi Boggiano
On Sat, Apr 2, 2011 at 1:38 PM, Jacob Oettinger wrote: > On Mar 31, 2011, at 21:10 , Rasmus Lerdorf wrote: > >> On 03/31/2011 10:58 AM, Martin Scotta wrote: >>> I think it's time to stop thinking in terms of "functions" and move >>> forward to "abstractions" >>> >>> $s1 = 'string'; >>> $s1->contai

Re: [PHP-DEV] Adding a more logical string slicing function to PHP

2011-04-02 Thread Jacob Oettinger
On Mar 31, 2011, at 21:10 , Rasmus Lerdorf wrote: > On 03/31/2011 10:58 AM, Martin Scotta wrote: >> 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); >> >>