diff options
author | Sebastian Bergmann <sebastian@php.net> | 2002-09-04 16:50:01 +0000 |
---|---|---|
committer | Sebastian Bergmann <sebastian@php.net> | 2002-09-04 16:50:01 +0000 |
commit | af4243b90829df092d88f62cb53b44e43ef5c25f (patch) | |
tree | e08deabcf43e0e1cdf1c3a3e30f8406e87f351c7 /Zend/ZEND_CHANGES | |
parent | 0b25d07f155f2bac76c2af8a4e5e2758fe3722e3 (diff) | |
download | php-git-af4243b90829df092d88f62cb53b44e43ef5c25f.tar.gz |
Whitespace fixes.
Diffstat (limited to 'Zend/ZEND_CHANGES')
-rw-r--r-- | Zend/ZEND_CHANGES | 113 |
1 files changed, 61 insertions, 52 deletions
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES index 48e12b79ca..817001cc4b 100644 --- a/Zend/ZEND_CHANGES +++ b/Zend/ZEND_CHANGES @@ -483,7 +483,7 @@ Changes in the Zend Engine 2.0 <?php class foo { - static $my_static = 5; + static $my_static = 5; } print foo::$my_static; @@ -534,57 +534,66 @@ Changes in the Zend Engine 2.0 * __autoload(). TBD. - * Method calls and property accesses can be overloaded by class - methods __call(), __get() and __set(). - Examples: - - <?php - class Setter { - var $n; - var $x = array("a"=>1,"b"=>2,"c"=>3); - 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"; - } - } - 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"; - } - } - } - - $foo = new Setter(); - $foo->n = 1; - $foo->a = 100; - $foo->a++; - $foo->z++; - var_dump($foo); - ?> - - <?php - class Caller { - var $x = array(1,2,3); - function __call($m, $a) { - print "Method $m called:\n"; - var_dump($a); - return $this->x; - } - } - - $foo = new Caller(); - $a = $foo->test(1, "2", 3.4, true); - var_dump($a); - ?> + * Method calls and property accesses can be overloaded + by class methods __call(), __get() and __set(). + + __get() and __set() Example: + + <?php + class Setter { + public $n; + public $x = array('a' => 1, 'b' => 2, 'c' => 3); + + 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"; + } + } + + 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"; + } + } + } + + $foo = new Setter(); + $foo->n = 1; + $foo->a = 100; + $foo->a++; + $foo->z++; + var_dump($foo); + ?> + + __call() Example: + + <?php + class Caller { + var $x = array(1, 2, 3); + + function __call($m, $a) { + print "Method $m called:\n"; + var_dump($a); + return $this->x; + } + } + + $foo = new Caller(); + $a = $foo->test(1, '2', 3.4, true); + var_dump($a); + ?> + Changes in the Zend Engine 1.0 |