Hello.
Excuse my ignorance on this, but I can't seem to find the answer I'm
looking for online... Will PHP5 be able to do "chaining" as some other
languages are able to do?
In other words...
<?php
class A
{
function A() { print "made an A...<br>\n"; }
function getB() { return new B(); }
}
class B
{
function B() { print "made a B...<br>\n"; }
function shout() { print "hey!!"; }
}
$a = &new A();
$a->getB()->shout();
?>
This kind of polymorphism is something I'm used to, and I'm hoping it
won't result in a parse error in PHP5. =)
--
Dan Ostrowski
Hello.
Excuse my ignorance on this, but I can't seem to find the answer I'm
looking for online... Will PHP5 be able to do "chaining" as some other
languages are able to do?
Yes. It can.
Cheers,
Rob.
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
Hello Dan,
The answer that you are looking for can be found on the Zend site:
http://www.zend.com/php5/articles/engine2-php5-changes.php#Heading13
--
Best regards,
Jason mailto:jason@ionzoft.com
Friday, August 13, 2004, 6:59:44 PM, you wrote:
DO> Hello.
DO> Excuse my ignorance on this, but I can't seem to find the answer I'm
DO> looking for online... Will PHP5 be able to do "chaining" as some other
DO> languages are able to do?
DO> In other words...
DO> ------------------------------
DO> <?php
DO> class A
DO> {
DO> function A() { print "made an A...<br>\n"; }
DO> function getB() { return new B(); }
DO> }
DO> class B
DO> {
DO> function B() { print "made a B...<br>\n"; }
DO> function shout() { print "hey!!"; }
DO> }
DO> $a = &new A();
$a->>getB()->shout();
?>>
DO> ----------------------------
DO> This kind of polymorphism is something I'm used to, and I'm hoping it
DO> won't result in a parse error in PHP5. =)
DO> --
DO> Dan Ostrowski