Doc #61169 [NEW]: unpack() with unnamed elements

From: Date: Thu, 23 Feb 2012 13:24:58 +0000
Subject: Doc #61169 [NEW]: unpack() with unnamed elements
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7990@lists.php.net to get a copy of this message
From: Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:unpack() with unnamed elements Description: ------------ --- From manual page: http://www.php.net/function.unpack#refsect1-function.unpack-notes --- A paragraph in the documentation for unpack says: >Be aware that if you do not name an element, an empty string is used. If you do not name more than one element, this means that some data is overwritten as the keys are the same such as in: It is not correct that an empty string is used. The index 1 is used. var_dump(unpack('V', 'abcd')); array(1) { [1]=> int(1684234849) } (It could not be inferred that the documentation means an empty string with "1" appended, because the number is not appended to a lone entry's name:) var_dump(unpack('Vname', 'abcd')); array(1) { ["name"]=> int(1684234849) } Here's a clearer way to write it: >If you do not name an element, numeric indices starting from 1 are used. Be aware that if you have more than one unnamed element, some data is overwritten because the numbering restarts from 1 for each element. -- Edit bug report at https://bugs.php.net/bug.php?id=61169&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61169&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61169&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61169&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61169&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61169&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61169&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61169&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61169&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61169&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61169&r=support Expected behavior: https://bugs.php.net/fix.php?id=61169&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61169&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61169&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61169&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61169&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61169&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61169&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61169&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61169&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61169&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61169&r=mysqlcfg

« previous php.doc.bugs (#7990) next »