Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119561 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16886 invoked from network); 16 Feb 2023 07:57:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Feb 2023 07:57:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CA4E4180210 for ; Wed, 15 Feb 2023 23:57:22 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS30827 82.113.144.0/20 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Wed, 15 Feb 2023 23:57:22 -0800 (PST) Received: from [127.0.0.1] (unknown [148.252.128.220]) by xdebug.org (Postfix) with ESMTPSA id 5BBBA10C530; Thu, 16 Feb 2023 07:57:21 +0000 (GMT) Date: Thu, 16 Feb 2023 07:57:19 +0000 To: internals@lists.php.net, Lydia de Jongh User-Agent: K-9 Mail for Android In-Reply-To: References: <92c4514f-70e3-75c9-7084-9e29641e25e7@gmail.com> <7e86a2d2-b971-592c-64e3-e86c13b5be80@cubiclesoft.com> <84204896-F9CE-4186-8A72-573A0B46FC1D@gmail.com> Message-ID: <68DBCD9C-849A-4840-9437-AE59F90A8B9C@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Working With Substrings From: derick@php.net (Derick Rethans) On 15 February 2023 13:03:39 GMT, Lydia de Jongh wro= te: >Hi, >Very interesting topic! On which I have NO experience =F0=9F=99=88 > > > >Op wo 15 feb=2E 2023 om 08:02 schreef Rowan Tommins : > >> On 15 February 2023 05:18:50 GMT, Rowan Tommins >> wrote: >> >My instinct was that it could just be a built-in class, with an intern= al >> pointer to a zend_string that's completely invisible to userland=2E Som= ething >> like how the SimpleXML and DOM objects just point into a libxml parse >> result=2E >> >> To make this a bit more concrete, what I was picturing was that instead= of >> this example: >> >> str_splice($this->pagemap[$pagepos][0], $x2, $size2, $data, $x, $size); >> >> You would have something like this: >> >> // Wrap an existing zend_string in an object >> $destBuffer =3D Buffer:: fromString($this->pagemap[$pagepos][0]); >> // Similar, but also track start and end offsets >> $sourceBuffer =3D Buffer::fromSubString($data, $x, $size); >> // Now do the actual memory copy >> $destBuffer->splice($x2, $size2, $sourceBuffer); >> >> >> > >In some other languages every variable IS an object=2E=2E=2E=2E=2E by def= ault=2E > >As far as I understand, the code above is meant as internal=2E >But what if any variable is a small object=2E >Has this been ever considered? Or would it use too much performance? > >$oString =3D 'my text'; > >$oString->toUpper(); > >echo $oString; // 'MY TEXT' > > > >Greetz, Lydia https://wiki=2Ephp=2Enet/rfc/unicode_text_processing And yes, that won't be as fast as just calling strtoupper=2E=20 cheers Derick