# Function java_closure

Wraps a PHP environment.

Closes over the php environment and packages it up as a java class. Use java_closure() to convert a PHP object into an equivalent Java object.

Example:

    function toString() {return "helloWorld";};
    $object = java_closure();
    echo "Java says that PHP says: $object\n";

When a php instance is supplied as an argument, the instance will be used instead. When a string or key/value map is supplied as a second argument, the java procedure names are mapped to the php procedure names. Example:

    function hello() {return "hello";};
    echo (string)java_closure(null, "hello");

When an array of java interfaces is supplied as a third argument, the environment must implement these interfaces. Example:

    class Listener {
      function actionPerformed($actionEvent) {
          ...
        }
    }
    function getListener() {
        return java_closure(new Listener(), null, array(new Java("java.awt.event.ActionListener")));
    }

License: GPL
Author: Jost Boekemeier
See: `java_values()`
Located at JavaProxy.inc