Checking If a Function Exists in PHP


Before calling a custom function, check if it exists with function_exists().

Source Code

if (function_exists('myFunction')) {
    myFunction();
} else {
    echo "myFunction does not exist";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments