note 130644 added to function.unpack

From: Date: Sat, 07 Feb 2026 18:16:20 +0000
Subject: note 130644 added to function.unpack
Groups: php.notes 
Request: Send a blank email to php-notes+get-222537@lists.php.net to get a copy of this message
It's with much frustration that I learned, that data packed with "Z" cannot be unpacked again. The unpack() function cannot read back a NUL-terminated string. For example, this simply doesn't work as one expects: var_dump(unpack('ZZ', "Hello\x00World\x00")); Produces: array(1) { ["Z"]=> string(1) "H" } (And no, "Z*" won't help here. I'm not even sure what "Z" is useful for at this point.) ---- Server IP: 206.189.2.9 Probable Submitter: 212.51.128.33 ---- Manual Page -- https://php.net/manual/en/function.unpack.php Edit -- https://main.php.net/note/edit/130644 Del: integrated -- https://main.php.net/note/delete/130644/integrated Del: useless -- https://main.php.net/note/delete/130644/useless Del: bad code -- https://main.php.net/note/delete/130644/bad+code Del: spam -- https://main.php.net/note/delete/130644/spam Del: non-english -- https://main.php.net/note/delete/130644/non-english Del: in docs -- https://main.php.net/note/delete/130644/in+docs Del: other reasons-- https://main.php.net/note/delete/130644 Reject -- https://main.php.net/note/reject/130644 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#222537) next »