Re: Fw: unpack()
| From: | Dmitry Stogov | Date: | Thu, 25 Feb 2016 13:02:32 +0000 |
| Subject: | Re: Fw: unpack() | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91401@lists.php.net to get a copy of this message | ||
On 02/25/2016 03:05 PM, Nikita Popov wrote:
On Thu, Feb 25, 2016 at 8:08 AM, Dmitry Stogov <dmitry@zend.com <mailto:dmitry@zend.com>> wrote:I've just got to know about possible usage of "@" in unpack(), but it seems doesn't work at all $ sapi/cli/php -r 'var_dump(unpack("@0l", "\x01\x00\x00\x00")); ' array(0) { } Do I use it properly? Thanks. Dmitry.________________________________ From: Dmitry Stogov Sent: Wednesday, February 24, 2016 13:35 To: Hynek Bartoš; php-dev@lists.php.net <mailto:php-dev@lists.php.net>; php-general-help@lists.php.net <mailto:php-general-help@lists.php.net> Subject: Re: unpack()Hi,I think the requested feature may be really useful.And the implementation is really simple https://gist.github.com/dstogov/edbb1efcd1e9701e75abI think, committing this into master doesn't require RFC and voting.Anyone objects?How should this interact with absolute position references? Your current patch changes input and inputlen, so absolute offsets will be relative to the "offset" parameter and not relative to the actual start of the string. Is this supposed to be so? And on that note, isn't this already covered by prefixing the unpack with @offset? (Not to say that an explicit offset argument wouldn't be more elegant.)