didou Sun Jun 10 23:13:24 2007 UTC
Modified files:
/phpdoc/en/reference/var/functions isset.xml print-r.xml
serialize.xml unserialize.xml
unset.xml
Log:
Switch to new doc style
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/isset.xml?r1=1.16&r2=1.17&diff_format=u
Index: phpdoc/en/reference/var/functions/isset.xml
diff -u phpdoc/en/reference/var/functions/isset.xml:1.16
phpdoc/en/reference/var/functions/isset.xml:1.17
--- phpdoc/en/reference/var/functions/isset.xml:1.16 Sun Jun 10 22:32:35 2007
+++ phpdoc/en/reference/var/functions/isset.xml Sun Jun 10 23:13:23 2007
@@ -1,41 +1,73 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.16 $ -->
-<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
+<!-- $Revision: 1.17 $ -->
<refentry id="function.isset">
<refnamediv>
<refname>isset</refname>
<refpurpose>Determine whether a variable is set</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>isset</methodname>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
<methodparam
choice="opt"><type>mixed</type><parameter>var</parameter></methodparam>
<methodparam choice="opt"><parameter>...</parameter></methodparam>
</methodsynopsis>
-
- <simpara>
- Returns &true; if <parameter>var</parameter> exists; &false; otherwise.
- </simpara>
+ <para>
+ Determine whether a variable is set.
+ </para>
<para>
If a variable has been unset with <function>unset</function>, it will no
- longer be set. <function>isset</function> will
- return &false; if testing a variable that has been set to &null;. Also
- note that a &null; byte (<literal>"\0"</literal>) is not equivalent to
- the PHP &null; constant.
+ longer be set. <function>isset</function> will return &false; if testing a
+ variable that has been set to &null;. Also note that a &null; byte
+ (<literal>"\0"</literal>) is not equivalent to the PHP &null; constant.
</para>
- <note>
- <title>Warning</title>
- <para>
- <function>isset</function> only works with variables as passing anything
- else will result in a parse error. For checking if
- <link linkend="language.constants">constants</link> are set use the
- <function>defined</function> function.
- </para>
- </note>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
<para>
- <informalexample>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>var</parameter></term>
+ <listitem>
+ <para>
+ The variable to be checked.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>var</parameter></term>
+ <listitem>
+ <para>
+ Another variable ..
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>...</parameter></term>
+ <listitem>
+ <para>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns &true; if <parameter>var</parameter> exists; &false; otherwise.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>isset</function> Examples</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -67,7 +99,7 @@
?>
]]>
</programlisting>
- </informalexample>
+ </example>
</para>
<para>
This also work for elements in arrays:
@@ -91,20 +123,36 @@
</programlisting>
</informalexample>
</para>
-
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <warning>
+ <para>
+ <function>isset</function> only works with variables as passing anything
+ else will result in a parse error. For checking if
+ <link linkend="language.constants">constants</link> are set use the
+ <function>defined</function> function.
+ </para>
+ </warning>
¬e.language-construct;
-
- <simpara>
- See also <function>empty</function>,
- <function>unset</function>,
- <function>defined</function>,
- <link linkend="types.comparisons">the type comparison tables</link>,
- <function>array_key_exists</function>,
- <function>is_null</function>,
- and the error control
- <link linkend="language.operators.errorcontrol">@</link> operator.
- </simpara>
</refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>empty</function></member>
+ <member><function>unset</function></member>
+ <member><function>defined</function></member>
+ <member><link linkend="types.comparisons">the type comparison
tables</link></member>
+ <member><function>array_key_exists</function></member>
+ <member><function>is_null</function></member>
+ <member>the error control <link
linkend="language.operators.errorcontrol">@</link> operator</member>
+ </simplelist>
+ </para>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/print-r.xml?r1=1.14&r2=1.15&diff_format=u
Index: phpdoc/en/reference/var/functions/print-r.xml
diff -u phpdoc/en/reference/var/functions/print-r.xml:1.14
phpdoc/en/reference/var/functions/print-r.xml:1.15
--- phpdoc/en/reference/var/functions/print-r.xml:1.14 Sun Jun 10 22:32:35 2007
+++ phpdoc/en/reference/var/functions/print-r.xml Sun Jun 10 23:13:23 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.14 $ -->
-<!-- splitted from ./en/functions/var.xml, last change in rev 1.5 -->
+<!-- $Revision: 1.15 $ -->
<refentry id="function.print-r">
<refnamediv>
<refname>print_r</refname>
@@ -8,42 +7,121 @@
Prints human-readable information about a variable
</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>print_r</methodname>
<methodparam><type>mixed</type><parameter>expression</parameter></methodparam>
<methodparam
choice="opt"><type>bool</type><parameter>return</parameter></methodparam>
</methodsynopsis>
- <note>
- <simpara>
- The <parameter>return</parameter> parameter was added in PHP 4.3.0
- </simpara>
- </note>
- <simpara>
+ <para>
<function>print_r</function> displays information about a variable
- in a way that's readable by humans. If given a <type>string</type>,
- <type>integer</type> or <type>float</type>, the value itself will be
- printed. If given an <type>array</type>,
- values will be presented in a format that shows keys and
- elements. Similar notation is used for <type>object</type>s.
+ in a way that's readable by humans.
+ </para>
+ <para>
<function>print_r</function>, <function>var_dump</function> and
<function>var_export</function> will
also show protected and private properties of objects with PHP 5.
- </simpara>
- <simpara>
+ </para>
+ <para>
Remember that <function>print_r</function> will move the array
pointer to the end. Use <function>reset</function> to bring
it back to beginning.
- </simpara>
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
<para>
- <informalexample>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>expression</parameter></term>
+ <listitem>
+ <para>
+ The expression to be printed.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>return</parameter></term>
+ <listitem>
+ <para>
+ If you would like to capture the output of
<function>print_r</function>,
+ use the <parameter>return</parameter> parameter. If this parameter is
set
+ to &true;, <function>print_r</function> will return its output, instead
of
+ printing it (which it does by default).
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ If given a <type>string</type>, <type>integer</type> or <type>float</type>,
+ the value itself will be printed. If given an <type>array</type>, values
+ will be presented in a format that shows keys and elements. Similar
+ notation is used for <type>object</type>s.
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ ¬e.uses-ob;
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>4.3.0</entry>
+ <entry>
+ The <parameter>return</parameter> parameter was added. If you need to
+ capture the output of <function>print_r</function> with an older
+ version of PHP prior, use the
+ <link linkend="ref.outcontrol">output-control functions</link>.
+ </entry>
+ </row>
+ <row>
+ <entry>4.0.4</entry>
+ <entry>
+ Prior to PHP 4.0.4, <function>print_r</function> will continue forever
+ if given an <type>array</type> or <type>object</type> that
+ contains a direct or indirect reference to itself. An example
+ is <literal>print_r($GLOBALS)</literal> because
+ <literal>$GLOBALS</literal> is itself a global variable that
+ contains a reference to itself.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>print_r</function> example</title>
<programlisting role="php">
<![CDATA[
<pre>
<?php
- $a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
- print_r ($a);
+$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
+print_r ($a);
?>
</pre>
]]>
@@ -66,51 +144,34 @@
</pre>
]]>
</screen>
- </informalexample>
- </para>
- <para>
- If you would like to capture the output of <function>print_r</function>,
- use the <parameter>return</parameter> parameter. If this parameter is set
- to &true;, <function>print_r</function> will return its output, instead of
- printing it (which it does by default).
+ </example>
</para>
- ¬e.uses-ob;
<para>
<example>
<title><parameter>return</parameter> parameter example</title>
<programlisting role="php">
<![CDATA[
<?php
- $b = array ('m' => 'monkey', 'foo' => 'bar', 'x' => array ('x', 'y', 'z'));
- $results = print_r($b, true); //$results now contains output from print_r
+$b = array ('m' => 'monkey', 'foo' => 'bar', 'x' => array ('x', 'y', 'z'));
+$results = print_r($b, true); // $results now contains output from print_r
?>
]]>
</programlisting>
</example>
</para>
- <note>
- <simpara>
- If you need to capture the output of <function>print_r</function> with a
- version of PHP prior to 4.3.0, use the <link linkend="ref.outcontrol">
- output-control functions</link>.
- </simpara>
- </note>
- <note>
- <simpara>
- Prior to PHP 4.0.4, <function>print_r</function> will continue forever
- if given an <type>array</type> or <type>object</type> that
- contains a direct or indirect reference to itself. An example
- is <literal>print_r($GLOBALS)</literal> because
- <literal>$GLOBALS</literal> is itself a global variable that
- contains a reference to itself.
- </simpara>
- </note>
- <simpara>
- See also <function>ob_start</function>,
- <function>var_dump</function> and
- <function>var_export</function>.
- </simpara>
</refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>ob_start</function></member>
+ <member><function>var_dump</function></member>
+ <member><function>var_export</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/serialize.xml?r1=1.12&r2=1.13&diff_format=u
Index: phpdoc/en/reference/var/functions/serialize.xml
diff -u phpdoc/en/reference/var/functions/serialize.xml:1.12
phpdoc/en/reference/var/functions/serialize.xml:1.13
--- phpdoc/en/reference/var/functions/serialize.xml:1.12 Sun Jun 10
22:32:35 2007
+++ phpdoc/en/reference/var/functions/serialize.xml Sun Jun 10 23:13:23 2007
@@ -1,62 +1,68 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.12 $ -->
-<!-- splitted from ./en/functions/var.xml, last change in rev 1.28 -->
+<!-- $Revision: 1.13 $ -->
<refentry id="function.serialize">
<refnamediv>
<refname>serialize</refname>
- <refpurpose>
- Generates a storable representation of a value
- </refpurpose>
+ <refpurpose>Generates a storable representation of a value</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>string</type><methodname>serialize</methodname>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
</methodsynopsis>
- <simpara>
- <function>serialize</function> returns a string containing a
- byte-stream representation of <parameter>value</parameter> that
- can be stored anywhere.
- </simpara>
- <simpara>
+ <para>
+ Generates a storable representation of a value
+ </para>
+ <para>
This is useful for storing or passing PHP values around without
losing their type and structure.
- </simpara>
- <simpara>
+ </para>
+ <para>
To make the serialized string into a PHP value again, use
- <function>unserialize</function>. <function>serialize</function>
- handles all types, except the <type>resource</type>-type.
- You can even <function>serialize</function> arrays that contain
- references to itself. Circular references inside the array/object you
- are <function>serialize</function>ing will also be stored. Any other
- reference will be lost.
- </simpara>
- <simpara>
- When serializing objects, PHP will attempt to call the member function
- <function>__sleep</function> prior to serialization. This is to allow the
- object to do any last minute clean-up, etc. prior to being serialized.
- Likewise, when the object is restored using <function>unserialize</function>
- the <function>__wakeup</function> member function is called.
- </simpara>
- <note>
- <simpara>
- This didn't work correctly until 4.0.7.
- </simpara>
- </note>
- <note>
- <para>
- In PHP 3, object properties will be serialized, but methods are
- lost. That limitation was removed in PHP 4 as both properties
- and methods are now restored. 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>
- <para>
- It is not possible to serialize PHP built-in objects.
- </para>
- </note>
+ <function>unserialize</function>.
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>value</parameter></term>
+ <listitem>
+ <para>
+ The value to be serialized. <function>serialize</function>
+ handles all types, except the <type>resource</type>-type.
+ You can even <function>serialize</function> arrays that contain
+ references to itself. Circular references inside the array/object you
+ are <function>serialize</function>ing will also be stored. Any other
+ reference will be lost.
+ </para>
+ <para>
+ When serializing objects, PHP will attempt to call the member function
+ <function>__sleep</function> prior to serialization. This is to allow
the
+ object to do any last minute clean-up, etc. prior to being serialized.
+ Likewise, when the object is restored using
<function>unserialize</function>
+ the <function>__wakeup</function> member function is called.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns a string containing a byte-stream representation of
+ <parameter>value</parameter> that can be stored anywhere.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
<para>
<example>
<title><function>serialize</function> example</title>
@@ -70,7 +76,7 @@
$conn = odbc_connect("webdb", "php", "chicken");
$stmt = odbc_prepare($conn,
"UPDATE sessions SET data = ? WHERE id = ?");
-$sqldata = array (serialize($session_data), $PHP_AUTH_USER);
+$sqldata = array (serialize($session_data), $_SERVER['PHP_AUTH_USER']);
if (!odbc_execute($stmt, &$sqldata)) {
$stmt = odbc_prepare($conn,
"INSERT INTO sessions (id, data) VALUES(?, ?)");
@@ -83,10 +89,60 @@
</programlisting>
</example>
</para>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>4.0.7</entry>
+ <entry>
+ The object serialization process was fixed.
+ </entry>
+ </row>
+ <row>
+ <entry>4.0.0</entry>
+ <entry>
+ When serializing an object, methods are not lost anymore.
+ Please see the
+ <link linkend="language.oop.serialization">Serializing Objects</link>
+ for more information.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <note>
+ <para>
+ It is not possible to serialize PHP built-in objects.
+ </para>
+ </note>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
<para>
- See Also: <function>unserialize</function>.
+ <simplelist>
+ <member><function>unserialize</function></member>
+ <member><link linkend="language.oop.serialization">Serializing
Objects</link></member>
+ </simplelist>
</para>
</refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/unserialize.xml?r1=1.20&r2=1.21&diff_format=u
Index: phpdoc/en/reference/var/functions/unserialize.xml
diff -u phpdoc/en/reference/var/functions/unserialize.xml:1.20
phpdoc/en/reference/var/functions/unserialize.xml:1.21
--- phpdoc/en/reference/var/functions/unserialize.xml:1.20 Sun Jun 10
22:32:35 2007
+++ phpdoc/en/reference/var/functions/unserialize.xml Sun Jun 10 23:13:23 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.20 $ -->
-<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
+<!-- $Revision: 1.21 $ -->
<refentry id="function.unserialize">
<refnamediv>
<refname>unserialize</refname>
@@ -8,78 +7,102 @@
Creates a PHP value from a stored representation
</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>unserialize</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<simpara>
- <function>unserialize</function> takes a single serialized
- variable (see <function>serialize</function>) and converts it
- back into a PHP value. The converted value is returned, and can
- be a <type>boolean</type>, <type>integer</type>, <type>float</type>,
- <type>string</type>, <type>array</type> or <type>object</type>.
- In case the passed string is not unserializeable, &false; is returned and
- <literal>E_NOTICE</literal> is issued.
+ <function>unserialize</function> takes a single serialized variable and
+ converts it back into a PHP value.
</simpara>
- <warning>
- <para>
- &false; is returned both in the case of an error and if unserializing
- the serialized &false; value. It is possible to catch this special case by
- comparing <parameter>str</parameter> with
- <literal>serialize(false)</literal> or by catching the issued
- <literal>E_NOTICE</literal>.
- </para>
- </warning>
- <note>
- <title>unserialize_callback_func directive</title>
- <para>
- It's possible to set a callback-function which will be called,
- if an undefined class should be instantiated during unserializing.
- (to prevent getting an incomplete <type>object</type>
"__PHP_Incomplete_Class".)
- Use your &php.ini;, <function>ini_set</function> or &htaccess;
- to define 'unserialize_callback_func'. Everytime an undefined class
- should be instantiated, it'll be called. To disable this feature just
- empty this setting. Also note that the directive
- unserialize_callback_func directive became
- available in PHP 4.2.0.
- </para>
- </note>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
<para>
- If the variable being unserialized is an object, after successfully
- reconstructing the object PHP will automatically attempt to call the
- <function>__wakeup</function> member function (if it exists).
- <example>
- <title>unserialize_callback_func example</title>
- <programlisting role="php">
-<![CDATA[
-<?php
-$serialized_object='O:1:"a":1:{s:5:"value";s:3:"100";}';
+ <variablelist>
+ <varlistentry>
+ <term><parameter>str</parameter></term>
+ <listitem>
+ <para>
+ The serialized string.
+ </para>
+ <para>
+ If the variable being unserialized is an object, after successfully
+ reconstructing the object PHP will automatically attempt to call the
+ <function>__wakeup</function> member function (if it exists).
+ </para>
+ <para>
+ <note>
+ <title>unserialize_callback_func directive</title>
+ <para>
+ It's possible to set a callback-function which will be called,
+ if an undefined class should be instantiated during unserializing.
+ (to prevent getting an incomplete <type>object</type>
"__PHP_Incomplete_Class".)
+ Use your &php.ini;, <function>ini_set</function> or &htaccess;
+ to define 'unserialize_callback_func'. Everytime an undefined class
+ should be instantiated, it'll be called. To disable this feature just
+ empty this setting.
+ </para>
+ </note>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
-// unserialize_callback_func directive available as of PHP 4.2.0
-ini_set('unserialize_callback_func', 'mycallback'); // set your
callback_function
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ The converted value is returned, and can be a <type>boolean</type>,
+ <type>integer</type>, <type>float</type>, <type>string</type>,
+ <type>array</type> or <type>object</type>.
+ </para>
+ <para>
+ In case the passed string is not unserializeable, &false; is returned and
+ <literal>E_NOTICE</literal> is issued.
+ </para>
+ </refsect1>
-function mycallback($classname)
-{
- // just include a file containing your classdefinition
- // you get $classname to figure out which classdefinition is required
-}
-?>
-]]>
- </programlisting>
- </example>
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>4.2.0</entry>
+ <entry>
+ The directive unserialize_callback_func directive became available.
+ </entry>
+ </row>
+ <row>
+ <entry>4.0.0</entry>
+ <entry>
+ When serializing an object, methods are not lost anymore.
+ Please see the
+ <link linkend="language.oop.serialization">Serializing Objects</link>
+ for more information.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
</para>
- <note>
- <para>
- In PHP 3, methods are not preserved when unserializing a
- serialized object. That limitation was removed in PHP 4 as both
- properties and methods are now restored. 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>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
<para>
<example>
<title><function>unserialize</function> example</title>
@@ -92,7 +115,7 @@
$conn = odbc_connect("webdb", "php", "chicken");
$stmt = odbc_prepare($conn, "SELECT data FROM sessions WHERE id = ?");
-$sqldata = array ($PHP_AUTH_USER);
+$sqldata = array($_SERVER['PHP_AUTH_USER']);
if (!odbc_execute($stmt, &$sqldata) || !odbc_fetch_into($stmt, &$tmp)) {
// if the execute or fetch fails, initialize to empty array
$session_data = array();
@@ -110,9 +133,50 @@
</example>
</para>
<para>
- See also <function>serialize</function>.
+ <example>
+ <title>unserialize_callback_func example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$serialized_object='O:1:"a":1:{s:5:"value";s:3:"100";}';
+
+// unserialize_callback_func directive available as of PHP 4.2.0
+ini_set('unserialize_callback_func', 'mycallback'); // set your
callback_function
+
+function mycallback($classname)
+{
+ // just include a file containing your classdefinition
+ // you get $classname to figure out which classdefinition is required
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <warning>
+ <para>
+ &false; is returned both in the case of an error and if unserializing
+ the serialized &false; value. It is possible to catch this special case by
+ comparing <parameter>str</parameter> with
+ <literal>serialize(false)</literal> or by catching the issued
+ <literal>E_NOTICE</literal>.
+ </para>
+ </warning>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>serialize</function></member>
+ </simplelist>
</para>
</refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/var/functions/unset.xml?r1=1.15&r2=1.16&diff_format=u
Index: phpdoc/en/reference/var/functions/unset.xml
diff -u phpdoc/en/reference/var/functions/unset.xml:1.15
phpdoc/en/reference/var/functions/unset.xml:1.16
--- phpdoc/en/reference/var/functions/unset.xml:1.15 Sun Jun 10 22:32:35 2007
+++ phpdoc/en/reference/var/functions/unset.xml Sun Jun 10 23:13:23 2007
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.15 $ -->
-<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
+<!-- $Revision: 1.16 $ -->
<refentry id="function.unset">
<refnamediv>
<refname>unset</refname>
<refpurpose>Unset a given variable</refpurpose>
</refnamediv>
- <refsect1>
- <title>Description</title>
+
+ <refsect1 role="description">
+ &reftitle.description;
<methodsynopsis>
<type>void</type><methodname>unset</methodname>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
@@ -15,39 +15,9 @@
<methodparam
choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
</methodsynopsis>
<para>
- <function>unset</function> destroys the specified variables. Note
- that in PHP 3, <function>unset</function> will always return &true;
- (actually, the integer value 1). In PHP 4, however,
- <function>unset</function> is no longer a true function: it is
- now a statement. As such no value is returned, and attempting to
- take the value of <function>unset</function> results in a parse
- error.
+ <function>unset</function> destroys the specified variables.
</para>
<para>
- <example>
- <title><function>unset</function> example</title>
- <programlisting role="php">
-<![CDATA[
-<?php
-// destroy a single variable
-unset($foo);
-
-// destroy a single element of an array
-unset($bar['quux']);
-
-// destroy more than one variable
-unset($foo1, $foo2, $foo3);
-?>
-]]>
- </programlisting>
- </example>
- </para>
- <note>
- <para>
- It is possible to unset even object properties visible in current context.
- </para>
- </note>
- <para>
The behavior of <function>unset</function> inside of a function
can vary depending on what type of variable you are attempting to
destroy.
@@ -181,15 +151,115 @@
</screen>
</informalexample>
</para>
+ </refsect1>
- ¬e.language-construct;
-
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>var</parameter></term>
+ <listitem>
+ <para>
+ The variable to be unset.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>var</parameter></term>
+ <listitem>
+ <para>
+ Another variable ..
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>...</parameter></term>
+ <listitem>
+ <para>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
<para>
- See also <function>isset</function>,
- <function>empty</function>, and
- <function>array_splice</function>.
+ &return.void;
</para>
</refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>4.0.0</entry>
+ <entry>
+ <function>unset</function> became an expression. (In PHP 3,
+ <function>unset</function> would always return 1).
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>unset</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// destroy a single variable
+unset($foo);
+
+// destroy a single element of an array
+unset($bar['quux']);
+
+// destroy more than one variable
+unset($foo1, $foo2, $foo3);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ ¬e.language-construct;
+ <note>
+ <para>
+ It is possible to unset even object properties visible in current context.
+ </para>
+ </note>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>isset</function></member>
+ <member><function>empty</function></member>
+ <member><function>array_splice</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file