svn: /phpdoc/en/trunk/reference/classobj/ examples.xml

From: Date: Sun, 19 Jun 2016 21:26:08 +0000
Subject: svn: /phpdoc/en/trunk/reference/classobj/ examples.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-14209@lists.php.net to get a copy of this message
fabioluciano Sun, 19 Jun 2016 21:26:08 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=339407 Log: removing unnecessary spaces Changed paths: U phpdoc/en/trunk/reference/classobj/examples.xml Modified: phpdoc/en/trunk/reference/classobj/examples.xml =================================================================== --- phpdoc/en/trunk/reference/classobj/examples.xml 2016-06-19 20:37:15 UTC (rev 339406) +++ phpdoc/en/trunk/reference/classobj/examples.xml 2016-06-19 21:26:08 UTC (rev 339407) @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> - <appendix xml:id="classobj.examples"> &reftitle.examples; <para> @@ -24,22 +23,22 @@ var $edible; var $color; - function Vegetable($edible, $color="green") + function Vegetable($edible, $color="green") { $this->edible = $edible; $this->color = $color; } - function is_edible() + function is_edible() { return $this->edible; } - function what_color() + function what_color() { return $this->color; } - + } // end of class Vegetable // extends the base class @@ -47,21 +46,21 @@ var $cooked = false; - function Spinach() + function Spinach() { $this->Vegetable(true, "green"); } - function cook_it() + function cook_it() { $this->cooked = true; } - function is_cooked() + function is_cooked() { return $this->cooked; } - + } // end of class Spinach ?> @@ -87,14 +86,14 @@ // utility functions -function print_vars($obj) +function print_vars($obj) { foreach (get_object_vars($obj) as $prop => $val) { echo "\t$prop = $val\n"; } } -function print_methods($obj) +function print_methods($obj) { $arr = get_class_methods(get_class($obj)); foreach ($arr as $method) { @@ -102,7 +101,7 @@ } } -function class_parentage($obj, $class) +function class_parentage($obj, $class) { if (is_subclass_of($GLOBALS[$obj], $class)) { echo "Object $obj belongs to class " . get_class($GLOBALS[$obj]); @@ -140,7 +139,7 @@ <para> One important thing to note in the example above is that the object <varname>$leafy</varname> is an instance of the class - <classname>Spinach</classname> which is a subclass of + <classname>Spinach</classname> which is a subclass of <classname>Vegetable</classname>, therefore the last part of the script above will output: </para>

« previous php.doc.cvs (#14209) next »