compiler to compile PHP source code into JVM bytecode: jphp

Source: Internet
Author: User

Jphp is a compiler similar to javac that compiles PHP source code into a JVM bytecode compiler. Then it was implemented to let the PHP program run on the Java Virtual machine. It supports many of the php5.3+ features. Jphp is similar to JRuby and Jython.

Support: JDK 1.6+ (OpenJDK, Oracle).

Goal

Jphp is not a replacement for Zend PHP engine or Facebook HHVM. It does not want to implement the Zend runtime (e.g. Curl, Prce, etc.). This entry is for:

    1. The ability to make useful Java objects in PHP
    2. Improve performance with JIT and JVM
    3. Use a better runtime library instead of Zend PHP's Ugly Runtime library
    4. Let PHP not only be used to develop Web applications
    5. Also:unicode for strings and threads

Characteristics

    • 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 sandboxes 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 of language support

(without Zend Runtime libraries)

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

What does it not support?

    • 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 home: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.