summaryrefslogtreecommitdiff
path: root/Zend/ZEND_CHANGES
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/ZEND_CHANGES')
-rw-r--r--Zend/ZEND_CHANGES78
1 files changed, 75 insertions, 3 deletions
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES
index 8b7f465964..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;
@@ -510,11 +510,22 @@ Changes in the Zend Engine 2.0
$backtrace = debug_backtrace();
foreach ($backtrace as $step) {
- $class = isset($step['class']) ? $step['class'] . '::' : '';
+ if (!empty($step['args'])) {
+ foreach ($step['args'] as $arg) {
+ $args = isset($args) ? $args . ', ' : '';
+ $args .= var_export($arg, true);
+ }
+ } else {
+ $args = '';
+ }
+
+ $args = str_replace(array("\n", ',)'), array('', ')'), $args);
printf(
- "%s [%s:%s]\n",
+ "%s%s(%s) [%s:%s]\n",
+ isset($step['class']) ? $step['class'] . '::' : '',
$step['function'],
+ $args,
$step['file'],
$step['line']
);
@@ -523,6 +534,67 @@ Changes in the Zend Engine 2.0
* __autoload(). TBD.
+ * 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
The Zend Engine was designed from the ground up for increased speed,