Php to python converter online

Input Code



Output Code

How to use?

Your php code must be inside <?php ?> tag.

And your code must be valid not produce any kind of warning and error.

Introduction

This tool are convert PHP code to equivalent, relevant Python 3 code. Generally Php and Python are two different languages. And this language is developing day by day on the basis of characteristics. So it would be foolish to differentiate their popularity. Our goal is to convert existing PHP code into Python. This can be useful for those who want to convert their project to Python and is searching for its medium.

Please note that this tool is still in its infancy. This is capable to convert user defined functions and some inbuilt Php method. Whose parity is less than 40% now. However it can be made more precise. We are working on it continuously. And will try to give you a better medium.

Array conversion example

Php code

<?php
  // Simple array with only values
  $simple = array(10,20,30,40,50);
  print_r($simple);
?>

Php Output


Array
(
    [0] => 10
    [1] => 20
    [2] => 30
    [3] => 40
    [4] => 50
)

Equivalent python code

from collections import OrderedDict
# Simple OrderedDict
simple = OrderedDict([(0,10),(1,20),(2,30),(3,40),(4,50)]);
print(simple);

Python Output

OrderedDict([(0, 10), (1, 20), (2, 30), (3, 40), (4, 50)])
Php Array to Python Dictionary ยป