php-doc-en/reference/json/constants.xml
2010-03-18 17:15:03 +00:00

157 lines
3.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="json.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
&extension.constants;
<para>
The following constants indicate the type of error returned by
<function>json_last_error</function>. They are all available as of
PHP 5.3.0.
</para>
<variablelist>
<varlistentry>
<term>
<constant>JSON_ERROR_NONE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
No error has occurred.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>JSON_ERROR_DEPTH</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
The maximum stack depth has been exceeded.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>JSON_ERROR_CTRL_CHAR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Control character error, possibly incorrectly encoded.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>JSON_ERROR_SYNTAX</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Syntax error.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>JSON_ERROR_UTF8</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Malformed UTF-8 characters, possibly incorrectly encoded. This
constant is available as of PHP 5.3.1.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>
The following constants can be combined to form options for
<function>json_encode</function>. They are all available as of
PHP 5.3.0.
</para>
<variablelist>
<varlistentry>
<term>
<constant>JSON_HEX_TAG</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
All &lt; and &gt; are converted to \u003C and \u003E.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>JSON_HEX_AMP</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
All &amp;s are converted to \u0026.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>JSON_HEX_APOS</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
All ' are converted to \u0027.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>JSON_HEX_QUOT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
All " are converted to \u0022.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>JSON_FORCE_OBJECT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Outputs an object rather than an array when a non-associative array is
used. Especially useful when the recipient of the output is expecting
an object and the array is empty.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</appendix>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->