Skip to content

Instantly share code, notes, and snippets.

@SushantSinghRajput03
Created June 17, 2020 07:40
<!DOCTYPE html>
<html>
<body>
<?php
function myTest() {
$x = 5; // local scope
echo "<p>Variable x inside function is: $x</p>";
}
myTest();
// using x outside the function will generate an error
echo "<p>Variable x outside function is: $x</p>";
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment