summaryrefslogtreecommitdiffstats
path: root/globals.php
diff options
context:
space:
mode:
Diffstat (limited to 'globals.php')
-rw-r--r--globals.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/globals.php b/globals.php
new file mode 100644
index 0000000..ade8d6d
--- /dev/null
+++ b/globals.php
@@ -0,0 +1,16 @@
+<?php
+/*
+ *
+ */
+
+function foo() {
+ // when a file is included, the code it contains inherits the variable scope of the line on which the include occurs
+ include 'global_vars.php';
+ echo $color;
+}
+
+// prints green
+foo();
+
+// undefined
+echo $color;