PHP program how to use $GLOBALS[] array example



php source

<!DOCTYPE html>
<html>
<body>

<?php
$x = 5;
$y = 10;

function myTest() {
     $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
}

myTest();
echo $y;
?>


</body>
</html>

output

15

0 comments:

Post a Comment

My Instagram