<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.11 $ --> <refentry xml:id="function.get-object-vars" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>get_object_vars</refname> <refpurpose>Gets the properties of the given object</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>get_object_vars</methodname> <methodparam><type>object</type><parameter>object</parameter></methodparam> </methodsynopsis> <para> Gets the properties of the given <parameter>object</parameter>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>object</parameter></term> <listitem> <para> An object instance. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns an associative array of defined object properties for the specified <parameter>object</parameter>. If a property have not been assigned a value, it will be returned with a &null; value. </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>prior to 4.2.0</entry> <entry> If the variables declared in the class of which the <parameter>object</parameter> is an instance, have not been assigned a value, those will not be returned in the array </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>Use of <function>get_object_vars</function></title> <programlisting role="php"> <![CDATA[ <?php class Point2D { var $x, $y; var $label; function Point2D($x, $y) { $this->x = $x; $this->y = $y; } function setLabel($label) { $this->label = $label; } function getPoint() { return array("x" => $this->x, "y" => $this->y, "label" => $this->label); } } // "$label" is declared but not defined $p1 = new Point2D(1.233, 3.445); print_r(get_object_vars($p1)); $p1->setLabel("point #1"); print_r(get_object_vars($p1)); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Array ( [x] => 1.233 [y] => 3.445 [label] => ) Array ( [x] => 1.233 [y] => 3.445 [label] => point #1 ) ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>get_class_methods</function></member> <member><function>get_class_vars</function></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:"../../../../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 -->