This is what I want to do:
$var = "foo";
$unknown = "";
function do($arg1, $arg2) {
$arg2 = "bar";
magic($arg2);
}
do($var, $unknown);
echo $unknown;
This should return: bar
I know that this would work if I'd define my function like this:
function do($arg1, $unknown) {
global $unknown;
$unknown = "bar";
}
As you probably guessed already, the variable name of $unknown is unknown.
I need this because I'm writing a PHP sandbox using apd. I want to replace exec($cmd, $ret) in a PHP script I don't known with my own function.
So if the unknown PHP script looks like this:
$foo = "";
exec('whois google.com', $foo);
echo $foo;
I'll have a problem replacing exec with my own function do() emulating the same functionality.