I have two php files, say
action.php
require_once 'action_helper.php';
storeDataToDb($data); //function from action_helper.php
logPersistIsPerformed(); //function from action_helper
echo $success; //variable set in action_helper.php
action_helper.php
$success = "success";
function storeDataToDB($data) {
// persist data
}
function logPersistIsPerformed() {
insertToDB($success);
}
I'm not sure if this is just a scope issue but what I encounter is when action.php calls the functions and variables declared in action_helper.php there are no issues.
but when I call a function in action_helper.php from action.php, which calls a variable declared in action_helper.php, it doesn't seem to see this success variable.
during debugging, once I loaded the page, I get to see all the variables both from action and action_helper. but when I get to step into the function from action_helper, I'm not able to see the variables declared in action_helper but just the variables passed into that function.