Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51778 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52904 invoked from network); 31 Mar 2011 18:10:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2011 18:10:20 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.214.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:63916] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AF/94-27840-B83C49D4 for ; Thu, 31 Mar 2011 13:10:19 -0500 Received: by iwn3 with SMTP id 3so3017076iwn.29 for ; Thu, 31 Mar 2011 11:10:17 -0700 (PDT) Received: by 10.42.134.130 with SMTP id l2mr3432494ict.428.1301595016688; Thu, 31 Mar 2011 11:10:16 -0700 (PDT) Received: from [192.168.200.140] (c-76-126-236-132.hsd1.ca.comcast.net [76.126.236.132]) by mx.google.com with ESMTPS id wo15sm757326icb.16.2011.03.31.11.10.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 31 Mar 2011 11:10:15 -0700 (PDT) Message-ID: <4D94C380.2070402@lerdorf.com> Date: Thu, 31 Mar 2011 11:10:08 -0700 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: Martin Scotta CC: internals@lists.php.net References: <4D92CC38.5040900@toolpark.com> <004301cbeee8$e54a8280$afdf8780$@com> <4D9387BE.4030808@divbyzero.net> <4D94984D.8060700@lerdorf.com> <4D94A111.7050501@moonspot.net> <520FB834-2614-4873-AC3B-0B2594B18471@roshambo.org> <4D94A350.70201@lerdorf.com> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Adding a more logical string slicing function to PHP From: rasmus@lerdorf.com (Rasmus Lerdorf) 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); > > 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. 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. Anybody out there have a patch along these lines? -Rasmus