summaryrefslogtreecommitdiffstats
path: root/global_from-func-to-global.php
diff options
context:
space:
mode:
Diffstat (limited to 'global_from-func-to-global.php')
-rw-r--r--global_from-func-to-global.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/global_from-func-to-global.php b/global_from-func-to-global.php
new file mode 100644
index 0000000..94d3f81
--- /dev/null
+++ b/global_from-func-to-global.php
@@ -0,0 +1,10 @@
+<?php
+
+function foo() {
+ global $foo;
+ $foo = 'bar';
+}
+
+foo();
+// prints 'bar'
+echo $foo;