nicolasrod / php2python

Convert PHP code to Python under CGI (beta)
MIT License
47 stars 22 forks source link

ByRef variables #4

Closed nicolasrod closed 3 years ago

nicolasrod commented 4 years ago

Take into account variables by reference. The following code:

<?php declare(strict_types=1);

function test(int &$num) {
    $num = 23;
}

$v = 44;
test($v);
echo $v;

Should be translated into:

def test(num_):
   test.num_ = num_
   test.num_ = 23

v = 44
test(v)
v = test.num_
print(v)