First of all, I’ve used function_exists to check, if my function was previously declared but doesn’t help.
This is my code:
if ( !function_exists('something') ) {
function something($params) {
[..]
}
}
And when I enter to the page, which has declared this function twice, then the following error occurring: Fatal error: Cannot redeclare something() (previously declared in [..])
So the question is, how I can check, if the function exists already, and if it exists skip loading it twice?
1 Answer