HH\fun
Create a function reference to a global function
namespace HH;
function fun(
string $func_name,
);
The global function fun('func_name') creates a reference to a global
function.
The parameter 'func_name' is a constant string with the full name of the
global function to reference.
Hack provides a variety of methods that allow you to construct references to methods for delegation. The methods in this group are:
class_methfor static methods on a classfunfor global functionsinst_methfor instance methods on a single objectmeth_callerfor an instance method where the instance will be determined later- Or use anonymous code within a lambda expression.
Example
<?hh // strict
$v = vec["Hello", " ", "World", "!"];
// Each line below prints "Hello World!"
Vec\map($v, fun('printf'));
Vec\map($v, $x ==> { printf($x); });
Parameters
string $func_nameA constant string with the name of the global method, including namespace if required.
Returns
$func- A fully typed function reference to the global method.