svn: /phpdoc/ru/trunk/reference/json/functions/ json-encode.xml
| From: | Alexander Moskaliov | Date: | Mon, 12 Dec 2011 07:59:40 +0000 |
| Subject: | svn: /phpdoc/ru/trunk/reference/json/functions/ json-encode.xml | ||
| Groups: | php.doc.ru | ||
| Request: | Send a blank email to doc-ru+get-3393@lists.php.net to get a copy of this message | ||
irker Mon, 12 Dec 2011 07:59:40 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=320878
Log:
Updated translation
Changed paths:
U phpdoc/ru/trunk/reference/json/functions/json-encode.xml
Modified: phpdoc/ru/trunk/reference/json/functions/json-encode.xml
===================================================================
--- phpdoc/ru/trunk/reference/json/functions/json-encode.xml 2011-12-12 06:33:43 UTC (rev 320877)
+++ phpdoc/ru/trunk/reference/json/functions/json-encode.xml 2011-12-12 07:59:40 UTC (rev 320878)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 320312 Maintainer: irker Status: ready -->
+<!-- EN-Revision: 320527 Maintainer: irker Status: ready -->
<!-- Reviewed: yes -->
<!-- $Revision$ -->
<refentry xml:id="function.json-encode" xmlns="http://docbook.org/ns/docbook">
@@ -176,6 +176,76 @@
]]>
</screen>
</example>
+ <example>
+ <title>Пример с последовательными индексамим
начинающимися с нуля и непоследовательными индексами
массивов</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+echo "Последовательный массив".PHP_EOL;
+$sequential = array("foo", "bar", "baz", "blong");
+var_dump(
+ $sequential,
+ json_encode($sequential)
+);
+
+echo PHP_EOL."Непоследовательный массив".PHP_EOL;
+$nonsequential = array(1=>"foo", 2=>"bar", 3=>"baz",
4=>"blong");
+var_dump(
+ $nonsequential,
+ json_encode($nonsequential)
+);
+
+echo PHP_EOL."Последовательный массив с одним удаленным
индексом".PHP_EOL;
+unset($sequential[1]);
+var_dump(
+ $sequential,
+ json_encode($sequential)
+);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Последовательный массив
+array(4) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+ [2]=>
+ string(3) "baz"
+ [3]=>
+ string(5) "blong"
+}
+string(27) "["foo","bar","baz","blong"]"
+
+Непоследовательный массив
+array(4) {
+ [1]=>
+ string(3) "foo"
+ [2]=>
+ string(3) "bar"
+ [3]=>
+ string(3) "baz"
+ [4]=>
+ string(5) "blong"
+}
+string(43)
"{"1":"foo","2":"bar","3":"baz","4":"blong"}"
+
+Последовательный массив с одним удаленным индексом
+array(3) {
+ [0]=>
+ string(3) "foo"
+ [2]=>
+ string(3) "baz"
+ [3]=>
+ string(5) "blong"
+}
+string(33)
"{"0":"foo","2":"baz","3":"blong"}"
+]]>
+ </screen>
+ </example>
</para>
</refsect1>
@@ -187,6 +257,13 @@
для определения точной ошибки.
</para>
</note>
+ <note>
+ <para>
+ При кодировании массива в случае, если его индексы
не являются
+ последовательными числами от нуля, то все индексы
кодируются в строковые
+ ключи для каждой пары индекс-значение.
+ </para>
+ </note>
</refsect1>
<refsect1 role="seealso">