Arrays passed by reference, instead of by value
Danack opened this issue · 1 comments
Danack commented
$arr=array();
function foo($arr){
array_push($arr, 4);
}
foo($arr);
var_dump($arr);
will show array(0) {} in PHP, but is converted to Javascript as:
var arr={};
function foo (arr){
array_push($arr, 4);
}
foo(arr);
console.log(arr);
which will show [4].
Danack commented
This is just going to be a limitation of the converter. There is no sane workaround to this, as you would need to be able to type the variable to an array, which is beyond the scope of the tool.