Re: Why are serialized strings wrapped in double quotes? (s:<len>:"<string>")

From: Date: Wed, 07 Feb 2024 12:28:26 +0000
Subject: Re: Why are serialized strings wrapped in double quotes? (s:<len>:"<string>")
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-122327@lists.php.net to get a copy of this message
Hi Sandy On Tue, Feb 6, 2024 at 9:19 PM Sanford Whiteman <figureonecpr@gmail..com> wrote: > > I'd like a little background on something we've long accepted: why > does the serialization format need double quotes around a string, even > though the byte length is explicit? > > Example: > > s:5:"hello"; > > All else being equal I would think we could have just > > s:5:hello; > > Was this just to make strings look more 'stringy', even though the > format isn't meant to be human-readable? I don't have the historical context, but I'm assuming that's it. PHPs serialization format is not efficient, and I don't think that was ever the primary focus. If you need something more efficient, you can try https://github.com/igbinary/igbinary which is aimed to be a drop-in replacement. Ilija

« previous php.internals (#122327) next »