function id($x)libphutil Technical Documentation (Core Utilities)
function id($x)
libphutil Technical Documentation (Core Utilities)
Identity function, returns its argument unmodified.
This is useful almost exclusively as a workaround to an oddity in the PHP grammar -- this is a syntax error:
new Thing()->doStuff();
...but this works fine:
id(new Thing())->doStuff();
Parameters
wild | $x | Anything. |
Return
wild | Unmodified argument. |
- Defined
- src/utils/utils.php:19