Hi, Very interesting topic! On which I have NO experience 🙈
Op wo 15 feb. 2023 om 08:02 schreef Rowan Tommins <rowan.coll...@gmail.com>: > On 15 February 2023 05:18:50 GMT, Rowan Tommins <rowan.coll...@gmail.com> > wrote: > >My instinct was that it could just be a built-in class, with an internal > pointer to a zend_string that's completely invisible to userland. Something > like how the SimpleXML and DOM objects just point into a libxml parse > result. > > 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 = Buffer:: fromString($this->pagemap[$pagepos][0]); > // Similar, but also track start and end offsets > $sourceBuffer = 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..... by default. As far as I understand, the code above is meant as internal. But what if any variable is a small object. Has this been ever considered? Or would it use too much performance? $oString = 'my text'; $oString->toUpper(); echo $oString; // 'MY TEXT' Greetz, Lydia