How can I define a global function which would be accessible from any page?
If you want your function to always be available, without including it, do this:
Create your function in a PHP file.
In your php.ini file, search for the option auto_prepend_file
and add your PHP file to that line, like this:
`auto_prepend_file = "/path/to/my_superglobal_function.php"`
Or if you write it with a non absolute path, like this:
auto_prepend_file = "my_superglobal_function.php"
It will look in your include_path
in php.ini
to find the file.