- Added information about the visibility (reported by fbn79@libero.it)

- Simplify example


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@257856 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Felipe Pena 2008-04-18 22:02:07 +00:00
parent 7362172ae6
commit 916384321d

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<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>
<refpurpose>Gets the public properties of the given object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
@ -12,7 +12,7 @@
<methodparam><type>object</type><parameter>object</parameter></methodparam>
</methodsynopsis>
<para>
Gets the properties of the given <parameter>object</parameter>.
Gets the public properties of the given <parameter>object</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
@ -33,7 +33,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an associative array of defined object properties for the
Returns an associative array of defined object public 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>
@ -71,35 +71,17 @@
<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);
}
class foo {
private $a;
public $b = 1;
public $c;
private $d;
static $e;
}
// "$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));
$test = new foo;
var_dump(get_object_vars($test));
?>
]]>
@ -107,19 +89,12 @@ print_r(get_object_vars($p1));
&example.outputs;
<screen>
<![CDATA[
Array
(
[x] => 1.233
[y] => 3.445
[label] =>
)
Array
(
[x] => 1.233
[y] => 3.445
[label] => point #1
)
array(2) {
["b"]=>
int(1)
["c"]=>
NULL
}
]]>
</screen>
</example>