whitespace changes

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@169558 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Aidan Lister 2004-09-29 15:51:49 +00:00
parent f175b914ca
commit 5e7b5e8abd

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<sect1 id="language.oop5.overloading">
<title>Overloading</title>
@ -37,31 +37,31 @@
<![CDATA[
<?php
class Setter {
public $n;
private $x = array("a" => 1, "b" => 2, "c" => 3);
public $n;
private $x = array("a" => 1, "b" => 2, "c" => 3);
function __get($nm) {
print "Getting [$nm]\n";
function __get($nm) {
print "Getting [$nm]\n";
if (isset($this->x[$nm])) {
$r = $this->x[$nm];
print "Returning: $r\n";
return $r;
} else {
print "Nothing!\n";
if (isset($this->x[$nm])) {
$r = $this->x[$nm];
print "Returning: $r\n";
return $r;
} else {
echo "Nothing!\n";
}
}
}
function __set($nm, $val) {
print "Setting [$nm] to $val\n";
function __set($nm, $val) {
print "Setting [$nm] to $val\n";
if (isset($this->x[$nm])) {
$this->x[$nm] = $val;
print "OK!\n";
} else {
print "Not OK!\n";
if (isset($this->x[$nm])) {
$this->x[$nm] = $val;
echo "OK!\n";
} else {
echo "Not OK!\n";
}
}
}
}
$foo = new Setter();
@ -89,17 +89,17 @@ Nothing!
Setting [z] to 1
Not OK!
object(Setter)#1 (2) {
["n"]=>
int(1)
["x:private"]=>
array(3) {
["a"]=>
int(101)
["b"]=>
int(2)
["c"]=>
int(3)
}
["n"]=>
int(1)
["x:private"]=>
array(3) {
["a"]=>
int(101)
["b"]=>
int(2)
["c"]=>
int(3)
}
}
]]>
</screen>
@ -132,13 +132,13 @@ object(Setter)#1 (2) {
<![CDATA[
<?php
class Caller {
private $x = array(1, 2, 3);
private $x = array(1, 2, 3);
function __call($m, $a) {
print "Method $m called:\n";
var_dump($a);
return $this->x;
}
function __call($m, $a) {
print "Method $m called:\n";
var_dump($a);
return $this->x;
}
}
$foo = new Caller();
@ -155,22 +155,22 @@ var_dump($a);
Method test called:
array(4) {
[0]=>
int(1)
[1]=>
string(1) "2"
[2]=>
float(3.4)
[3]=>
bool(true)
[0]=>
int(1)
[1]=>
string(1) "2"
[2]=>
float(3.4)
[3]=>
bool(true)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
]]>
</screen>