I'm trying to make an easy function for including file, but for some reason, the variables aren't being passed to.
In the file test.php:
<?php
function parse($template) {
require $template;
}
$test = "test";
parse("stuff.php");
?>
And the file stuff.php:
<?php
echo $test;
?>
And I'll get the error:
Notice: Undefined variable: test in /opt/lampp/htdocs/testinggrounds/stuff.php on line 2
However, if I replace this statement in test.php
parse("stuff.php");
with
require "stuff.php";
And it'll work just fine.