將PHP源碼編譯成JVM字節碼的編譯器:JPHP
JPHP是一個類似于javac的編譯器,它能夠將PHP源代碼編譯成JVM字節碼的編譯器。然后就實現了讓PHP程序運行在Java虛擬機器上。 它支持許多PHP5.3+的特性。JPHP與 JRuby和Jython相似。
支持: JDK 1.6+ (OpenJDK, Oracle)。
目標
JPHP不是 Zend PHP 引擎或非死book HHVM的一個代替。它并不想實現zend運行庫(比如:Curl, PRCE等)。這個項是為了:
- 能夠在PHP中使有用Java對象
- 通過 JIT 和 JVM提升性能
- 利用更好的運行時庫來代替Zend PHP的丑陋的運行時庫
- 讓PHP不單只能用于開發Web應用
- Also: unicode for strings and threads
特性
- 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
語言支持的特性
(without zend runtime libraries)
- PHP 5.2+ fully support (with OOP)
- Closures (PHP 5.3), auto-binding
$this
in closures (PHP 5.4) - Namespaces fully support (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)
還不支持什么?
- 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)
項目主頁:http://www.baiduhome.net/lib/view/home/1395628572618
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!