> Create something like $foo->bar?() or $foo->bar()?, where you don't
> care whether the function exists, or if $foo is an object. If it
> doesn't exist you just return null.

[1] Don't do this.

[2] What everyone else said.

[3] If you feel you must, this at least "colors within the lines" a
bit more than '@' by forcing you to set a class as wildcard-able:

class bitbucket {
        function __call($name,$arguments){
                return "default value";
        }
        function __get($name){
                return new self;
        }
}

class myClass extends bitbucket {}

$myInst = new MyClass;
print $myInst->noExist->nexistePas(); // "default value"

[4] Goto [1].

-- S.


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to