Compile the PHP source code into the JVM bytecode compiler: JPHP

Source: Internet
Author: User
Compile the PHP source code into the JVM bytecode compiler: JPHP

JPHP is a javac-like compiler that can compile PHP source code into JVM bytecode. Then, the PHP program is run on the Java VM. It supports many PHP5.3 + features. JPHP is similar to JRuby and Jython.

Supported: JDK 1.6 + (OpenJDK, Oracle ).

Target

JPHP is not a replacement of the Zend PHP engine or Facebook HHVM. It does not want to implement the zend runtime library (such as Curl and PRCE ). This item aims:

  1. Use Java objects in PHP
  2. Improve performance through JIT and JVM
  3. Use a better runtime library to replace the ugly runtime library of Zend PHP
  4. PHP is not only used to develop Web applications
  5. 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
Features supported by languages

(Without zend runtime libraries)

  • PHP 5.2 + fully support (with OOP)
  • Closures (PHP 5.3), auto-binding$thisIn 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)
  • __debugInfoFor 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)
  • ::classSystem constant (php 5.5)

What is not supported 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

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.