|
JPHP is a PHP implementation for Java virtual machines and supports many features of PHP (5.3 +. JPHP is responsible for compiling PHP source code into JVM bytecode so that it can run on JVM, which is similar to JRuby and Jython. It supports JDK 1.6 and later versions. This project was launched on July 15, last October.
JPHP has no intention of replacing the Zend PHP engine or Facebook HHVM (the idea of HHVM is to compile PHP into an intermediate bytecode, and then compile the bytecode into x64 machine code through JIT ). For the following reasons, the designer does not intend to implement the Zend runtime library (such as Curl and PRCE) for JPHP ):
- Ability to use Java Class Library in PHP
- Improve performance through JIT and JVM
- Use a better runtime library to replace the ugly runtime library of Zend PHP
- Extend the use of the PHP language beyond the Web
- JVM supports Unicode strings and threads better.
JPHP has the following functions:
- JIT (two to ten times faster than PHP 5.4)
- Optimizer (optimize constant expressions, inline functions, etc)
- Java class libraries and classes can be used in php code.
- Unicode string (similar to UTF-16 in Java)
- Thread, socket
- Environment Architecture (similar to sandbox objects in runkit zend extension)
- Supports GUI and is implemented and improved based on Swing, providing a more flexible layout.
- Embedded cache system for classes and functions
- Optional Hot update (Optional Hot Reloading) mechanism for classes and functions
Language features include:
- Fully supports PHP 5.2 + (including OOP)
- Closure (PHP 5.3), automatically bound to the closure $ this (PHP 5.4)
- Fully supports namespaces (PHP 5.3)
- Class spl automatic loading (PHP 5.3)
- Iterators, ArrayAccess, and Serializable
- Class, array, and callable type constraints (PHP 5.4)
- Array phrase method (PHP 5.4)
- GC for loop reference (PHP 5.3)
For more features, see The README file of the project.
In addition, JPHP provides some features not supported by PHP, such as exceptions and scalar type constraints in the _ toString method.
JPHP is not the first attempt to improve PHP performance. we will wait and see how it works. Interested readers can download and try it.
From: http://www.infoq.com/cn/news/2014/03/jphp |