This should probably have a simple answer I just can’t figure out.
Anyway, I have a php document and inside of it I define <?php $pathprefix = '../'; ?>
Later in the document I use an <?php require([somefile.php]); ?> and inside of somefile.php, I have a line that says <?php echo($pathprefix); ?> but the ‘../’ I assigned to $pathprefix never shows up. It acts like the variable was never instantiated. What is my problem?
Really need to see your source code to determine the scope. With what you’ve provided here’s two options:
Set in $GLOBALS
file1.php:
file2.php:
Use a class
file1.php:
file2.php:
Understand Scope in PHP
http://www.php.net/manual/en/language.variables.scope.php
Good luck.