I have a function that I use on index.php page and I would like to call it from other php page (other.php). How to make this function available without redeclaration? I think it's achievable using sessions, but I am not sure how to do it exactly.
Th problem is that it works in index.php, because it uses some API declaration, but it doesn't on other.php. I am not sure how to setup the API on other.php page, so I will need some sort of session pass rather than seperate file with functions. Any ideas?
EDIT: Maybe it's confusing, so I will try to clarify it. I have a page let's say index.php with a function: get_loggedin_user(); . It prints the user's name. It works in index.php because it is a part of a CMS system with an API and uses this API. The problem is that I would like to use this function on (or in worst case pass the user's name) to other page (other.php) which is accessible by the link form index.php. Now I would like to print user's name on other.php. Is this achievable? I know I can pass the name using sessions and I would like to know how to do this, or if it is possible, how to access this function. Hope it's clear now.