<?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> <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 accessible non-static properties of the given <parameter>object</parameter> according to scope. </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 accessible non-static properties for the specified <parameter>object</parameter> in scope. 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>5.3.0</entry> <entry> This function now returns <type>NULL</type> if the <parameter>object</parameter> isn't an object. Previously &false; was returned. </entry> </row> <row> <entry>4.2.0</entry> <entry> Properties which were declared in the class of the <parameter>object</parameter> but which weren't assigned a value are now also returned (with value &null;). </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 foo { private $a; public $b = 1; public $c; private $d; static $e; public function test() { var_dump(get_object_vars($this)); } } $test = new foo; var_dump(get_object_vars($test)); $test->test(); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ array(2) { ["b"]=> int(1) ["c"]=> NULL } array(4) { ["a"]=> NULL ["b"]=> int(1) ["c"]=> NULL ["d"]=> NULL } ]]> </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:"~/.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 -->