Answers for "global declare variable php"

PHP
2

how make a variable global php

$a = 1;
$b = 2;
function Sum(){
    global $a, $b; // allows access to vars outside of function
    $b = $a + $b;
} 

Sum();
echo $b; // output is 3
Posted by: Guest on April-26-2021

Browse Popular Code Answers by Language