svn: /phpdoc/en/trunk/reference/misc/functions/ unpack.xml
| From: | Christoph Michael Becker | Date: | Tue, 14 Jun 2016 14:23:39 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/misc/functions/ unpack.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-14187@lists.php.net to get a copy of this message | ||
cmb Tue, 14 Jun 2016 14:23:39 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=339347
Log:
Show example output instead of lengthy explanation
Changed paths:
U phpdoc/en/trunk/reference/misc/functions/unpack.xml
Modified: phpdoc/en/trunk/reference/misc/functions/unpack.xml
===================================================================
--- phpdoc/en/trunk/reference/misc/functions/unpack.xml 2016-06-14 14:02:02 UTC (rev 339346)
+++ phpdoc/en/trunk/reference/misc/functions/unpack.xml 2016-06-14 14:23:39 UTC (rev 339347)
@@ -105,13 +105,20 @@
<?php
$binarydata = "\x04\x00\xa0\x00";
$array = unpack("cchars/nint", $binarydata);
+print_r($array);
?>
]]>
</programlisting>
- <para>
- The resulting array will contain the entries "chars" with value
- <literal>4</literal> and "int" with <literal>160</literal>.
- </para>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [chars] => 4
+ [int] => 160
+)
+]]>
+ </screen>
</example>
</para>
@@ -123,13 +130,21 @@
<?php
$binarydata = "\x04\x00\xa0\x00";
$array = unpack("c2chars/nint", $binarydata);
+print_r($array);
?>
]]>
</programlisting>
- <para>
- The resulting array will contain the entries "chars1",
- "chars2" and "int".
- </para>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Array
+(
+ [chars1] => 4
+ [chars2] => 0
+ [int] => 40960
+)
+]]>
+ </screen>
</example>
</para>
</refsect1>
@@ -162,9 +177,19 @@
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+array(2) {
+ [1]=>
+ int(160)
+ [2]=>
+ int(66)
+}
+]]>
+ </screen>
<para>
- The resulting array will contain the entries "1" with value
- <literal>160</literal> and "2" with <literal>66</literal>.
The
+ Note that the
first value from the <literal>c</literal> specifier is
overwritten by the first value from the <literal>n</literal>
specifier.