I stumbled upon the JPHP project today which adds yet another direction to the PHP world. JPHP is an one man project by Dmitriy Zayceff who’s been working on it for the past 2 years and I must admit he must have spent a lot of time on it. Here’s some key points:
- Compile PHP code into Java Virtual Machine bytecode (into JAVa’s .class files)
- Use the standard PHP function library including some extensions.
- Can use any JAVA class through PHP code (you need to write a wrapper for it but it works)
- Create cross platform GUI or CLI applications
- Develop Android apps in PHP
- It executes faster than the current PHP branch and even faster than PHP7.
- Allows for both stateful and stateless execution when used as a Web scripting language (i.e. you can either choose to execute as a long-running process with shared memory or reset with every request like standard PHP.
- Can do just in time compilation of PHP files.
Project’s Github page.
Benchmarks can be found here. Page is in Japanese but all you need to look at is the two tables. The first shows the time taken for the 1st run of the benchmarks and the next run where the code is already pre-compiled and JPHP wins.