Page 1 of 1

Can I delete a function declaration?

Posted: Thu Apr 28, 2005 9:38 am
by AGISB
Here is my problem. I am using a custom session handler which uses the function showerror(). Now the problem comes on my logout page. I destroy the session and wants to start a new one. I get following error as the handler calls that function again.

Fatal error: Cannot redeclare showerror()

Is there any way I can delete that function declaration?



I know a solution to the problem as I can do a session_regenerate() instead of deleting and restarting but I want to know if I could do it another way.

Posted: Thu Apr 28, 2005 9:54 am
by m3mn0n
require_once() or include_once()

Those two prevent repeat declarations.
PHP Manual wrote:require_once() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc.