Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Global and Local Scope
SUBMITTED BY:
henry1874w
DATE:
June 4, 2017, 7:47 p.m.
FORMAT:
Text only
SIZE:
239 Bytes
Raw
Download
Tweet
HITS:
222
Go to comments
Report
<?php
$x = 5; // global scope
function myTest() {
// using x inside this function will generate an error
echo "<p>Variable x inside function is: $x</p>";
}
myTest();
echo "<p>Variable x outside function is: $x</p>";
?>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus