O'Reilly logo

Core PHP Programming, Third Edition by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

18.3. Java

In 1999 Sam Ruby added support to allow PHP to use Java objects. Java is Sun Microsystem's object-oriented language intended to be platform-independent. Java is very popular, and you won't have any trouble finding books, Web sites, and free source code. Perhaps the best place to get information about Java used on Web servers is the Java Apache Project <http://java.apache.org/>.

The Java extension creates a class called Java. You can use the new operator to instantiate any Java class in your class path. An object is returned that can be treated like any other PHP object. Its properties and methods match the Java class.

object Java::Java(string class, …)

To create a Java object, call this constructor with the name of a class. If the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required