global create function php code example
Example: php global variable function
<?php
$myVariable = "a";
function changeVar($newVar) {
global $myVariable
$myVariable = "b";
}
echo $myVariable; // Should echo b
?>
<?php
$myVariable = "a";
function changeVar($newVar) {
global $myVariable
$myVariable = "b";
}
echo $myVariable; // Should echo b
?>