Shaitan00
March 29th, 2009, 10:29 PM
I've run into a little problem, chances are the solution is simple but I've yet to uncover the work-around.
I'm trying to take a passed in parameter and pass it into a another function, but it comes out as being null, for example:
The following works fine:
public function get($ID)
{
$myA = new A();
return $myA->foo(1);
}
I can see that in foo() the value passed in is '1' as expected (obviously).
However when I try the following it seems to fail:
public function get($ID)
{
$myA = new A();
return $myA->foo($ID);
}
The difference is that I am passing in $id from get($ID) into foo($ID) - why doesn't this work?
The parameter in foo($ID) comes out as being NULL (unless I am not seeing this right).
Do I need to do like $temp = $ID and pass foo($temp) instead?
Any help would be much appreciated.
Thanks,
I'm trying to take a passed in parameter and pass it into a another function, but it comes out as being null, for example:
The following works fine:
public function get($ID)
{
$myA = new A();
return $myA->foo(1);
}
I can see that in foo() the value passed in is '1' as expected (obviously).
However when I try the following it seems to fail:
public function get($ID)
{
$myA = new A();
return $myA->foo($ID);
}
The difference is that I am passing in $id from get($ID) into foo($ID) - why doesn't this work?
The parameter in foo($ID) comes out as being NULL (unless I am not seeing this right).
Do I need to do like $temp = $ID and pass foo($temp) instead?
Any help would be much appreciated.
Thanks,