JPHP is a compiler similar to javac, which can compile PHP source code into JVM bytecode. Then it was realized to let the PHP program run on the Java virtual machine. It supports many PHP5.3+ features. JPHP is similar to JRuby and Jython.
Support: JDK 1.6+ (OpenJDK, Oracle).
Goal
JPHP is not a replacement for the Zend PHP engine or Facebook HHVM. It does not want to implement the zend runtime library (such as Curl, PRCE, etc.). This item is for:
- Ability to use useful Java objects in PHP
- Improving performance through JIT and JVM
- Utilize a better runtime library instead of Zend PHP’s ugly runtime library
- Let PHP not only be used to develop web applications
- Also: unicode for strings and threads
Features
- JIT (2x - 10x faster PHP 5.4)
- Optimizer (constant expressions, inline functions, etc.)
- Using java libraries and classes in PHP code.
- Unicode for strings (UTF-16, like in Java)
- Threading, Sockets
- Environment architecture (like sandbox objects in runkit zend extension).
- GUI (based on Swing, improved - more flexible layouts)
- Embedded cache system for classes and functions
- Optional Hot Reloading for classes and functions
Language supported features
(without zend runtime libraries)
- PHP 5.2+ fully supported (with OOP)
- Closures (PHP 5.3), auto-binding
$this in closures (PHP 5.4)
- Namespaces fully supported (PHP 5.3)
- Spl autoloading for classes (PHP 5.3)
- Iterators, ArrayAccess, Serializable
- Type hinting for classes, arrays, callable (PHP 5.4)
- Array short syntax (PHP 5.4)
- Ternary short cut "?:", NOWDOC,
__callStatic , __invoke (PHP 5.3)
- Late static binding (PHP 5.3)
- GC for cyclic references (PHP 5.3)
-
Class::{expr}() , (new Foo)->bar() (PHP 5.4)
- Try finally (PHP 5.5)
- Array and string literal dereferencing (PHP 5.5)
-
__debugInfo for var_dump (PHP 5.6)
- Function array dereferencing has been added, e.g.
foo()[0] (PHP 5.4)
- Constants can be declared outside a class using the const keyword. (PHP 5.3)
- Dynamic access to static methods (PHP 5.3)
- Exceptions can be nested (PHP 5.3)
-
::class system constant (php 5.5)
What doesn’t it support yet?
- Traits (php 5.4)
- Generators (php 5.5)
- Goto (php 5.3)
- list() in foreach (php 5.5)
- Binary number format, e.g. 0b001001101 (php 5.4)
Project homepage: http://www.open-open.com/lib/view/home/1395628572618
|