--- Brad LaFountain rodif_bl@yahoo.com wrote:
Date: Mon, 17 Mar 2003 05:42:37 -0800 (PST)
From: Brad LaFountain rodif_bl@yahoo.com
To: php-dev@lists.php.net
Subject: [PHP-DEV] __call for the namespacesThis idea spawned from playing with ext/rpc and the ability to declare
class types on the fly....Since zend_namespaces is really _zend_class_entry I think it would
be cool to implement __call at the namespace level.namespace java {
function __call($classname) {
// this will be called every time a new java::$classname() is called
// and $classname isn't defined
eval("
class $classname {
}
");
// and it can return the new class
return new $classname();
}
}This doesn't seem like it would be too hard to implement and it will allow me
to do stuff like...<?
$j = new java::java.util.Stack();
// $j could be of ns java:util and class Stack
$s = new soap::myObject("http://server/some.wsdl");
// $s could be the namespace defined in the wsdl and of class myObject
?>ps:
<?
namespace test {
class test1 {
function doSomething() {
eval("
class test2 { }
");
}
}
}$test1 = new test::test1();
$test1->doSomething();
?>
results in...
<b>Fatal error</b>: Internal Zend error - Missing class information for in
<b>
c:\php\php5\Release_TSDbg\name.php(7) : eval()'d code</b> on line <b>2</b><br />
- Brad
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com--
PHP Development Mailing List http://www.php.net/
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com