I am reading the documentation of php about Variable functions
I don't understand the example 4 below.
How come the first and second $func(); can call the function bar() and baz(). The $func is a array.
Maybe it is a silly question. Thanks.
<?php
class Foo
{
static function bar()
{
echo "bar\n";
}
function baz()
{
echo "baz\n";
}
}
$func = array("Foo", "bar");
$func(); // prints "bar"
$func = array(new Foo, "baz");
$func(); // prints "baz"
$func = "Foo::bar";
$func(); // prints "bar"
?>