In PHP you can do this:
function something() {
foreach (func_get_args() as $arg)
echo $arg;
}
something(1, 3); //echoes "13"
This works fine for arguments passed by value, but what if I want them to be passed by reference? like this:
function something_else() {
foreach (func_get_args() as $arg)
$arg *= 2;
}
$a = 1;
$b = 3;
something_else($a, $b);
echo $a . $b; //should echo "26", but returns "13" when I try it
Is this possible in PHP?
The question seems horrible, but lets humour you. Below is a horrible hack, but you could send across a single argument which contains the items that you want to work with.