Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
PHP The global Keyword
SUBMITTED BY:
henry1874w
DATE:
June 4, 2017, 7:57 p.m.
FORMAT:
Text only
SIZE:
130 Bytes
Raw
Download
Tweet
HITS:
240
Go to comments
Report
<?php
$x = 5;
$y = 10;
function myTest() {
global $x, $y;
$y = $x + $y;
}
myTest();
echo $y; // outputs 15
?>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus