mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
added notes about serializing objects in php4 and added links to the new serialization section of oop.xml
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@47746 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
8eae786de0
commit
7a1cff916c
1 changed files with 33 additions and 8 deletions
|
@ -883,14 +883,23 @@ print_r ($a);
|
|||
This is useful for storing or passing PHP values around without
|
||||
losing their type and structure.
|
||||
</simpara>
|
||||
<simpara>
|
||||
To make the serialized string into a PHP value again, use
|
||||
<function>unserialize</function>. <function>Serialize</function>
|
||||
handles the types <type>integer</type>, <type>double</type>,
|
||||
<type>string</type>, <type>array</type> (multidimensional) and
|
||||
<type>object</type> (object properties will be serialized, but
|
||||
methods are lost).
|
||||
</simpara>
|
||||
<simpara>
|
||||
To make the serialized string into a PHP value again, use
|
||||
<function>unserialize</function>. <function>Serialize</function>
|
||||
handles the types <type>integer</type>, <type>double</type>,
|
||||
<type>string</type>, <type>array</type> (multidimensional) and
|
||||
<type>object</type>.
|
||||
</simpara>
|
||||
<note>
|
||||
<para>
|
||||
In PHP 3, object properties will be serialized, but methods are
|
||||
lost. PHP 4 removes that limitation and restores both properties
|
||||
and methods. Please see the <link
|
||||
linkend="language.oop.serialization">Serializing Objects</link>
|
||||
section of <link linkend="language.oop">Classes and
|
||||
Objects</link> for more information.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Serialize</function> example</title>
|
||||
|
@ -913,6 +922,9 @@ if (!odbc_execute ($stmt, &$sqldata)) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See Also: <function>unserialize</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
@ -1019,6 +1031,16 @@ settype($bar, "string"); // $bar is now "1" (string)
|
|||
If an object was serialized, its methods are not preserved in the
|
||||
returned value.
|
||||
</simpara>
|
||||
<note>
|
||||
<para>
|
||||
In PHP 3, methods are not preserved when unserializing a
|
||||
serialized object. PHP 4 removes that limitation and restores
|
||||
both properties and methods. Please see the <link
|
||||
linkend="language.oop.serialization">Serializing Objects</link>
|
||||
section of <link linkend="language.oop">Classes and
|
||||
Objects</link> or more information.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Unserialize</function> example</title>
|
||||
|
@ -1044,6 +1066,9 @@ if (!odbc_execute ($stmt, &$sqldata) || !odbc_fetch_into ($stmt, &$tmp))
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See Also: <function>serialize</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue