[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

php to python code converter

On Friday, May 8, 2009 at 3:38:25 AM UTC-7, bvidinli wrote:
> if anybody needs:
> http://code.google.com/p/phppython/

The link is down.
I'd like to give a plug to mynewly released product `pyx.php` Python module:



Run Converted PHP Codes in Python with the Speed of Compiled-C

pyx.php is a Cython compiled module that you can use to convert or translate 99% of most common PHP source codes to pure Python. In another words, it is a PHP-to-Python syntax emulation library in Cython.

The converted Python codes only require a Python 3.x interpreter, the modules in the pyx repository, and some standard Python libraries. PHP interpreter is not needed at all.

If we have already translated most of the WordPress core and other scripts from PHP to Python using pyx.php, you can convert almost any PHP code into Python.

With the speed of compiled Cython, running Python code translated from PHP using pyx.php might be even faster than running the original PHP code in the same computer.

$ git clone https://github.com/wordpy/pyx/

Currently, pyx.php is only available for Python 3.x running 64-bit Linux. Python 2.x, Mac, or other platforms can be compiled when there are many requests.
Quick Start

$ python # or ipython

>>> import pyx.php as Php; array = Php.array
>>> arr1 = array( (0,'1-0'),('a','1-a'),('b','1-b'),)
>>> arr2 = array( (0,'2-0'),(  1,'2-1'),('b','2-b'),('c','2-c'),)
>>> arr1 + arr2   # same as: Php.array_plus(arr1, arr2), see below
>>> Php.array_merge(arr1, arr2)