jeroen Wed Jun 27 14:04:49 2001 EDT Modified files: /phpdoc/en/functions var.xml Log: <type>'d var.xml, improved documenation on serialize (not yet 'ready', though)
Index: phpdoc/en/functions/var.xml diff -u phpdoc/en/functions/var.xml:1.57 phpdoc/en/functions/var.xml:1.58 --- phpdoc/en/functions/var.xml:1.57 Sun Jun 24 19:47:13 2001 +++ phpdoc/en/functions/var.xml Wed Jun 27 14:04:49 2001 @@ -128,28 +128,28 @@ Possibles values for the returned string are: <itemizedlist> <listitem> - <simpara>"boolean" (since PHP 4)</simpara> + <simpara>"<type>boolean</type>" (since PHP 4)</simpara> </listitem> <listitem> - <simpara>"integer"</simpara> + <simpara>"<type>integer</type>"</simpara> </listitem> <listitem> - <simpara>"double"</simpara> + <simpara>"<type>double</type>"</simpara> </listitem> <listitem> - <simpara>"string"</simpara> + <simpara>"<type>string</type>"</simpara> </listitem> <listitem> - <simpara>"array"</simpara> + <simpara>"<type>array</type>"</simpara> </listitem> <listitem> - <simpara>"object"</simpara> + <simpara>"<type>object</type>"</simpara> </listitem> <listitem> - <simpara>"resource" (since PHP 4)</simpara> + <simpara>"<type>resource</type>" (since PHP 4)</simpara> </listitem> <listitem> - <simpara>"NULL" (since PHP 4)</simpara> + <simpara>"<type>NULL</type>" (since PHP 4)</simpara> </listitem> <listitem> <simpara>"user function" (PHP 3 only, deprecated)</simpara> @@ -246,8 +246,9 @@ </funcprototype> </funcsynopsis> <para> - This function returns a string representing the type of the resource - passed to it. If the paramater is not a valid resource, it + This function returns a string representing the type of the + <type>resource</type> passed to it. If the paramater is not a + valid <type>resource</type>, it generates an error. <informalexample> <programlisting role="php"> @@ -285,13 +286,13 @@ </funcprototype> </funcsynopsis> <simpara> - Returns the integer value of <parameter>var</parameter>, + Returns the <type>integer</type> value of <parameter>var</parameter>, using the specified base for the conversion (the default is base 10). </simpara> <simpara> <parameter>var</parameter> may be any scalar type. You cannot use - <function>intval</function> on arrays or objects. + <function>intval</function> on <type>array</type>s or <type>object</type>s. </simpara> <note> <para> @@ -323,7 +324,7 @@ </funcprototype> </funcsynopsis> <para> - Returns true if <parameter>var</parameter> is an array, false + Returns true if <parameter>var</parameter> is an <type>array</type>, false otherwise. </para> <para> @@ -360,7 +361,7 @@ </funcsynopsis> <para> Returns true if the <parameter>var</parameter> parameter is - a boolean. + a <type>boolean</type>. </para> <para> See also <function>is_array</function>, @@ -390,7 +391,7 @@ </funcprototype> </funcsynopsis> <para> - Returns true if <parameter>var</parameter> is a double, + Returns true if <parameter>var</parameter> is a <type>double</type>, false otherwise. </para> <para> @@ -512,7 +513,8 @@ </funcprototype> </funcsynopsis> <para> - Returns true if <parameter>var</parameter> is an integer (long), + Returns true if <parameter>var</parameter> is an <type>integer</type> + (long), false otherwise. </para> <para> @@ -545,7 +547,8 @@ </funcprototype> </funcsynopsis> <para> - Returns true if <parameter>var</parameter> is null, false otherwise. + Returns true if <parameter>var</parameter> is <type>null</type>, + false otherwise. </para> <para> See also <function>is_bool</function>, @@ -610,8 +613,8 @@ </funcprototype> </funcsynopsis> <para> - Returns true if <parameter>var</parameter> is an object, false - otherwise. + Returns true if <parameter>var</parameter> is an <type>object</type>, + false otherwise. </para> <para> See also <function>is_bool</function>, @@ -678,15 +681,13 @@ </funcsynopsis> <para> <function>is_resource</function> returns true if the variable - given by the <parameter>var</parameter> parameter is a resource, - otherwise it returns false. - </para> - <para> - Resources are things like file or database result handles that - are allocated and freed by internal PHP functions and that may - need some cleanup when they are no longer in use but haven't been - freed by user code. + given by the <parameter>var</parameter> parameter is a + <type>resource</type>, otherwise it returns +false. </para> + <para> + See the documentation on the +<type>resource</type>-type for + more information. + </para> </refsect1> </refentry> @@ -715,10 +716,13 @@ otherwise it returns false. </para> <para> - Scalar variables are those containing an integer, float, string - or boolean. For example: + Scalar variables are those containing an <type>integer</type>, + <type>float</type>, <type>string</type> or <type>boolean</type>. + For example: <informalexample> <programlisting role="php"> +<!-- TODO: better example, this one can be quite misleading for unexperienced + programmers --> function show_var($var) { if (is_scalar($var)) echo $var; @@ -747,7 +751,7 @@ </para> <note> <para> - <function>is_scalar</function> does not consider resource + <function>is_scalar</function> does not consider <type>resource</type> type values to be scalar values. This behavior is intentional: Resources are abstract datatypes which are currently based on integers. This implementation detail should not be relied upon, @@ -756,8 +760,7 @@ </note> <note> <para> - This function was added to the CVS code after the release of PHP - 4.0.4pl1 + Since 4.0.5 </para> </note> <para> @@ -790,7 +793,7 @@ </funcprototype> </funcsynopsis> <para> - Returns true if <parameter>var</parameter> is a string, + Returns true if <parameter>var</parameter> is a <type>string</type>, false otherwise. </para> <para> @@ -867,10 +870,11 @@ </funcsynopsis> <simpara> This function displays information about the values of variables - in a way that's readable by humans. If given a string, integer - or double, the value itself will be printed. If given an array, + in a way that's readable by humans. If given a <type>string</type>, + <type>integer</type> or <type>double</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 objects. + elements. Similar notation is used for <type>object</type>s. </simpara> <simpara> Remember that <function>print_r</function> will move the array @@ -894,9 +898,11 @@ </para> <warning> <para> - This function will continue forever if given an array or object + This function will continue forever if given an <type>array</type> + or <type>object</type> that contains a direct or indirect reference to itself or that - contains an array or object on a deeper level that does so. + contains an <type>array</type> or <type>object</type> on a deeper + level that does so. This is especially true for <literal>print_r($GLOBALS)</literal>, as <literal>$GLOBALS</literal> is itself a global variable and contains a reference to itself as such. @@ -932,10 +938,23 @@ <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>. + handles all types, except the <type>resource</type>-type. + You can even <function>serialize</function> arrays that contain + references to itself. References inside the +array/object you + are <function>serialize</function>ing will also be +stored. + </simpara> + <!-- TODO + in 4.0.4pl1 this +didn't work properly, however, there + been some fixes. I +don't know whether this all + works correctly now, +and if so, whether it is since 405 + or 406 + <note> + <simpara> + This didn't work correctly until 4.0.? + </simpara> + </note> </simpara> + --> <note> <para> In PHP 3, object properties will be serialized, but methods are @@ -1041,7 +1060,9 @@ </funcprototype> </funcsynopsis> <simpara> - Returns the string value of <parameter>var</parameter>. + Returns the <type>string</type> value of <parameter>var</parameter>. + See the documentation on <type>string</type> +for more information + on converting to string. </simpara> <simpara> <parameter>var</parameter> may be any scalar type. You cannot use