Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
PHP also stores all global variables in an array called $GLOBALS[index].
SUBMITTED BY:
henry1874w
DATE:
June 4, 2017, 7:59 p.m.
FORMAT:
Text only
SIZE:
144 Bytes
Raw
Download
Tweet
HITS:
300
Go to comments
Report
<?php
$x = 5;
$y = 10;
function myTest() {
$GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
}
myTest();
echo $y; // outputs 15
?>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus