jeroen Sat May 19 13:41:43 2001 EDT
Modified files:
/phpdoc/en/functions var.xml
Log:
- added warning about misuse of gettype
- added some see-also's
Index: phpdoc/en/functions/var.xml
diff -u phpdoc/en/functions/var.xml:1.48 phpdoc/en/functions/var.xml:1.49
--- phpdoc/en/functions/var.xml:1.48 Thu May 17 19:23:42 2001
+++ phpdoc/en/functions/var.xml Sat May 19 13:41:43 2001
@@ -113,6 +113,17 @@
Returns the type of the PHP variable
<parameter>var</parameter>.
</para>
+ <warning>
+ <simpara>
+ Never use <function>gettype</function> to test for a certain type,
+ since the returned string may be subject to change in a future version.
+ In addition, it is slow too, as it involves string comparision <!--
+ where's my dictionary? -->.
+ </simpara>
+ <simpara>
+ Instead, use the <literal>is_*</literal> functions.
+ </simpara>
+ </warning>
<para>
Possibles values for the returned string are:
<itemizedlist>
@@ -154,7 +165,18 @@
<function>gettype</function> on a function.
</para>
<para>
- See also <function>settype</function>.
+ See also
+ <function>settype</function>,
+ <function>is_array</function>,
+ <function>is_bool</function>,
+ <function>is_double</function>,
+ <function>is_integer</function>,
+ <function>is_null</function>,
+ <function>is_numeric</function>,
+ <function>is_object</function>,
+ <function>is_resource</function>,
+ <function>is_scalar</function> and
+ <function>is_string</function>.
</para>
</refsect1>
</refentry>
@@ -958,7 +980,8 @@
</itemizedlist>
</para>
<para>
- Returns true if successful; otherwise returns false.
+ Returns <literal>TRUE</literal> if successful; otherwise returns
+ <literal>FALSE</literal>.
</para>
<para>
<example>
@@ -973,7 +996,9 @@
</example>
</para>
<para>
- See also <function>gettype</function>.
+ See also <function>gettype</function>,
+ <link linkend="language.types.typecasting">type-casting</link> and
+ <link linkend="language.types.type-juggling">type-juggling</link>.
</para>
</refsect1>
</refentry>