if(function_exists($this->Common_model->disable_foreign_key_checks()) && function_exists($this->Common_model->increase_size_of_group_concat()) && function_exists($this->Common_model->increase_size_of_concat())){
echo 'SUCCESS';
}
else{
echo 'FAIL';
}
Anyone can please help me why function_exists not working? The project is based on CodeIgniter.
use method_exists
method here
if (method_exists($this->Common_model, 'disable_foreign_key_checks')){
echo 'SUCCESS';
} else{
echo 'FAIL';
}
Looking at your code it seems you completely misunderstand what function_exists()
does and what it takes as an argument.
function_exists('function_name')
returns true
if a function named 'function_name'
has been defined or false
if it has not.
Your code as written is using the return from a model to provide the 'function_name'
string. I seriously doubt any of those model methods return the name of a function.
I am going to make a wild guess at what you are really trying to do. I'm going to assume that each of the model functions will return true or false to indicate success or failure and you want to test for all three succeeding. If my guess is correct then this is the code you're looking for.
if($this->Common_model->disable_foreign_key_checks() &&
$this->Common_model->increase_size_of_group_concat() &&
$this->Common_model->increase_size_of_concat())
{
echo 'SUCCESS';
}
else
{
echo 'FAIL';
}