Minor clean up of examples.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@255662 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Daniel Convissor 2008-03-21 12:46:12 +00:00
parent bcf53732a1
commit e839ed6d20

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.26 $ -->
<!-- $Revision: 1.27 $ -->
<sect1 xml:id="language.oop5.overloading" xmlns="http://docbook.org/ns/docbook">
<title>Overloading</title>
@ -172,11 +172,13 @@ class MemberTest {
return $tmp;
}
/** As of PHP 5.1.0 */
public function __isset($name) {
echo "Is '$name' set?\n";
return isset($this->data[$name]);
}
/** As of PHP 5.1.0 */
public function __unset($name) {
echo "Unsetting '$name'\n";
unset($this->data[$name]);
@ -184,7 +186,7 @@ class MemberTest {
/** Not a magic method, just here for example. */
public function getHidden() {
echo "'hidden' visible here, __get() not used\n";
echo "'hidden' visible here so __get() not used\n";
return $this->hidden;
}
}
@ -219,12 +221,12 @@ Unsetting 'a'
Is 'a' set?
bool(false)
1
'hidden' visible here, __get() not used
'hidden' visible here so __get() not used
2
Getting 'hidden'
Notice: Undefined property: hidden in <file_name> on line 64 in <file_name> on line 28
Notice: Undefined property: hidden in <file> on line 64 in <file> on line 28
]]>
</screen>
@ -268,24 +270,22 @@ Notice: Undefined property: hidden in <file_name> on line 64 in <file_name> on
<![CDATA[
<?php
class MethodTest {
public $o = 'mmmmkay';
public static $s = 'uhhh...';
public function __call($name, $arguments) {
echo "Calling object method '$name' ";
echo implode(', ', $arguments). "\n";
echo "Calling object method '$name' "
. implode(', ', $arguments). "\n";
}
/** As of PHP 5.3.0 */
public static function __callStatic($name, $arguments) {
echo "Calling static method '$name' ";
echo implode(', ', $arguments). "\n";
echo "Calling static method '$name' "
. implode(', ', $arguments). "\n";
}
}
$obj = new MethodTest;
$obj->test('in object context');
MethodTest::test('in static context');
MethodTest::test('in static context'); // As of PHP 5.3.0
?>
]]>
</programlisting>