Fixes and new functionality in libzend
| From: | Zeev Suraski | Date: | Fri, 11 Jun 1999 11:18:06 +0000 |
| Subject: | Fixes and new functionality in libzend | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-1472@lists.php.net to get a copy of this message | ||
I fixed a couple of buglets in libzend last night, you're all encouraged
to update your copies.
Just now, I added some new functionality to Zend's concatenation
capabilities.
First,
$a = true;
print "\$a is $a";
will now print '$a is true' (instead of '$a is 1' as it used to).
Similarly,
$ar = array(1,2,3);
print "\$ar is $ar";
will now print '$ar is Array' (instead of '$ar is ' as it used to).
In addition, you can now override objects' concatenation behavior. By
default, adding an object in a quoted string will now put the word
'Object' in there. You can override it doing something like that:
class foo {
function to_string()
{
return "Foo Object";
}
};
$foo = new foo;
print $foo;
Will print out 'Foo Object'.
Note the scope these changes affect. They do NOT affect the type
conversions PHP makes on the fly - for example,
$x = true;
print (string) $x;
will print out '1', since we do want to be able to do a full round trip
here ($y = (bool) (string) $x; should not end up assigning false to $y).
Boolean casts are now also supported, by the way (as either (bool) or
(boolean)).
Zeev
--
-----------------------------------------------------
Zeev Suraski <zeev@zend.com>
For a PGP public key, finger bourbon@netvision.net.il