Reputation: 816
I don't really think this is possibly, but who know I may get surprised.
There is no way to explain it, unless I get into the code fast.
class foo
{
static function __callStatic($func, $arg)
{
//some magic here.
}
}
$foo = foo::bar();
$bar = foo::bar();
$x = foo::bar();
here is my expected output.
echo $foo; // foo
echo $bar; // bar
echo $x; // x
Upvotes: 0
Views: 42
Reputation: 12655
The variable is not present at that time. Only after the method call.
Test it:
class foo
{
static function __callStatic($func, $arg)
{
print_r($GLOBALS);
}
}
But why you need the var name?
Upvotes: 1