From: <php...@li...> - 2011-02-25 21:09:30
|
Hello! 1. function toString() {return "helloWorld";}; 2. $object = java_closure<http://php-java-bridge.sourceforge.net/pjb/docs/php-api/java/_JavaProxy.inc.html#functionjava_closure> (); 3. echo "Java says that PHP says: $object\n"; In this example, no arguments are passed in the java_closure() function. What does java_closure() transform? The current environment. 1. function hello() {return "hello";}; 2. echo (string)java_closure<http://php-java-bridge.sourceforge.net/pjb/docs/php-api/java/_JavaProxy.inc.html#functionjava_closure> (null, "hello"); In this example, I think the function hello() is transformed, The current environment, which all its procedures renamed to "hello". The manual talks about a keymap: maybe give an example? Why is the first argument null? java_closure(null, array("foo"=>"hello")); maps "foo" calls to "hello" procedures of the current environment. You are looking for: java_closure($phpObj, null, array(java("my.Interface1"), java("my.Interface2")...)); Peter |