I have:
include ('functions.php');
check_blocked();
echo $blocked;
in functions.php, check_blocked(); exists. Inside check_blocked I got:
global $blocked;
$blocked = '1234';
I want to echo $blocked variable, that are inside check_blocked().
It doesnt work, no output..
This is an example of my original problem, so please dont say that I could just have the echo inside the function, as I cannot have in my original code.
Your code should look like
$blocked = 0;
include('functions.php');
check_blocked();
echo $blocked;
With functions.php looking like
function check_blocked(){
global $blocked;
$blocked = 1234;
}
You must define blocked outside of the scope of the function before you global blocked into the function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With