There are many built-in PHP functions but you can also create your own.
Variables in a function are local ie are valid only in the scope of the function - unless declared as global. Note that global variables are declared in functions not outside as in other languages.
Static variables can also be used within a function such that their value is not lost between function calls.
Using references without using return or global no value is returned as values are passed to functions not references to variables.