diff options
author | Marcus Boerger <helly@php.net> | 2003-12-30 13:14:14 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-12-30 13:14:14 +0000 |
commit | 5e9279bb440de020d9e27445a2a2537f497df01b (patch) | |
tree | dda4a61c1ab08ffbaca1d8a8b5b466f7b0b6cf82 /Zend/ZEND_CHANGES | |
parent | b8f3838753ae2828aa20a350cee8f5cb3449dacd (diff) | |
download | php-git-5e9279bb440de020d9e27445a2a2537f497df01b.tar.gz |
Update
Diffstat (limited to 'Zend/ZEND_CHANGES')
-rw-r--r-- | Zend/ZEND_CHANGES | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES index 302b80f606..15cc44e07e 100644 --- a/Zend/ZEND_CHANGES +++ b/Zend/ZEND_CHANGES @@ -19,6 +19,35 @@ Changes in the Zend Engine 2.0 the box or after a very small amount of modifications would be high. + * $this + + Unlike in Zend Engine 1 the pseudo variable $this cannot be + exchanged in Zend Engine 2. You can of course modify or work with + an object by using $this but you cannot replace $this with another + object to change the original object. + + Example: + + <?php + class Foo { + function replace($other) + { + $this = $other; + } + } + + $object = new Foo; + $object->prop = 'Hello'; + + $other = new Foo; + $other->prop = 'Bye'; + + $object->replace($other); + + print $object->prop; // still shows 'Hello' + + ?> + * Private and Protected Members. The Zend Engine 2.0 introduces private and protected member @@ -717,7 +746,8 @@ Changes in the Zend Engine 2.0 * Iteration Objects may be iterated in an overloaded way when used with - foreach. The default behavior is to iterate over all properties. + foreach. The default behavior is to iterate over all properties + with respect to property visibility. Example: @@ -734,9 +764,6 @@ Changes in the Zend Engine 2.0 } ?> - TBD: Respect visibility: Show protected only when inside class - method and only otherwise public properties only. - Each class whose instances can be iterated with foreach should implement the empty interface 'Traversable'. Hence any object that says it implements 'Traversable' can be used with foreach. @@ -832,7 +859,12 @@ Changes in the Zend Engine 2.0 * __toString() The magic method __toString() allows to overload the object to - string conversion. + string conversion. This conversion is only done automatically for + printing functions (echo, *printf) but not for other functions + that expect strings. Also the function __toStrign is not used in + places where objects are not allowed but strings are like array + indices. Note that specialized objects maybe converted to a string + in any place but without calling __tostring(). Example: @@ -847,6 +879,10 @@ Changes in the Zend Engine 2.0 $str = (string) $obj; // call __toString() echo $obj; // call __toString() + + $ar = array(); + $ar[(string)$obj]; // this works + $ar[$obj]; // this is not allowed ?> * Reflection API |