I have a func.inc file as below
// STATUS_VALLUE
$status_failure = 0;
$status_success = 1;
function resultResultJson($status) {
echo $status;
echo $status_success;
}
And my function.php as below
<?php
include("./includes/func.inc");
resultResultJson($status_success);
?>
I'm expected result 11
. But I got 10
. Why is the function resultResultJson
not getting the right $status_success
result?
Updated
The https://stackoverflow.com/a/16959577/3286489 provides explanation on the variable scope, which explains why, but doesn't give a resolution. The below answer by @Niyoko Yuliawan helps.