Variables may store values from expression (e.g. constants or function calls) or callable function objects such as anonymous functions and named function pointers. In HSL variables are prefixed with $ followed by [a-zA-Z_]+[a-zA-Z0-9_]*. Variable names are case-sensitive. Some variables are read-only, hence they are not allowed to be assigned to (primarily pre-defined variables in contexts). Variables are assigned by value (copy-on-write).

$var="foo";$bar=$var;$bar="";// $var is still "foo"

Note

Variables in HSL are main/function scoped. However a variable needs to be created in all code paths before being used. isset() may test if a variable exists.

A lot of builtin functions are available in the function library. Functions are called by named followed by parentheses () with input parameters in between them. Function names are case-sensitive. The argument types must be supported by the function, otherwise an error will be raised. It’s also possible to create user-defined functions.

echouptime();echostrlen("Hello");

Warning

Calling a function with too few or too many arguments will raise an error, either during compilation time or at runtime (using argument unpacking).