hphp/hack/manual/apis/Functions/HH/fun.md
:::info[Note] This is a point-in-time snapshot of the API documentation from January 2026. Going forward, we will not be maintaining a public copy of these references, and recommend users to refer to the built-in signature helpers available in the Hack LSP instead for complete and up-to-date information. :::
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_meth for static methods on a classfun for global functionsinst_meth for instance methods on a single objectmeth_caller for an instance method where the instance will be determined later<?hh // strict
$v = vec["Hello", " ", "World", "!"];
// Each line below prints "Hello World!"
Vec\map($v, fun('printf'));
Vec\map($v, $x ==> { printf($x); });
string $func_name A constant string with the name of the global method, including namespace if required.$func - A fully typed function reference to the global method.