|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-02-24 15:17 UTC] hayk at mail dot ru
Description:
------------
When the function unpack returns an array with just one element, it doesn't have an index.
Reproduce code:
---------------
<?
$sp = chr(0x20);
$a = unpack('C1', $sp);
?>
<pre>
<? print_r($a); ?>
</pre>
Expected result:
----------------
Array
(
[] => 32
)
Actual result:
--------------
Array
(
[1] => 32
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 23:00:01 2025 UTC |
Why this code works fine? <? $sp = chr(0x20); $a = unpack('C2', $sp.$sp); ?> <pre> <? print_r($a); ?> </pre> We get: Array ( [1] => 32 [2] => 32 )