<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.settype" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>settype</refname>
  <refpurpose>Set the type of a variable</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>settype</methodname>
   <methodparam><type>mixed</type><parameter role="reference">var</parameter></methodparam>
   <methodparam><type>string</type><parameter>type</parameter></methodparam>
  </methodsynopsis>
  <para>
   Set the type of variable <parameter>var</parameter> to
   <parameter>type</parameter>.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>var</parameter></term>
     <listitem>
      <para>
       The variable being converted.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>type</parameter></term>
     <listitem>
      <para>
       Possibles values of <parameter>type</parameter> are:
       <itemizedlist>
        <listitem>
         <simpara>
          "boolean" or "bool"
         </simpara>
        </listitem>
        <listitem>
         <simpara>
          "integer" or "int"
         </simpara>
        </listitem>
        <listitem>
         <simpara>
          "float" or "double"
         </simpara>
        </listitem>
        <listitem>
         <simpara>
          "string"
         </simpara>
        </listitem>
        <listitem>
         <simpara>
          "array"
         </simpara>
        </listitem>
        <listitem>
         <simpara>
          "object"
         </simpara>
        </listitem>
        <listitem>
         <simpara>
          "null"
         </simpara>
        </listitem>
       </itemizedlist>
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>settype</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
$foo = "5bar"; // string
$bar = true;   // boolean

settype($foo, "integer"); // $foo is now 5   (integer)
settype($bar, "string");  // $bar is now "1" (string)
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <note>
   <para>
    Maximum value for "int" is <constant>PHP_INT_MAX</constant>.
   </para>
  </note>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>gettype</function></member>
    <member><link linkend="language.types.typecasting">type-casting</link></member>
    <member><link linkend="language.types.type-juggling">type-juggling</link></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>

<!-- 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
-->
