nscherneck 0 Posted July 15, 2016 Report Share Posted July 15, 2016 PHP beginner here. I have the following in index.php (the two files live in the same directory)... <?php require_once( dirname( __FILE__ ) . '/functions.php' ); ?> <!DOCTYPE html> <html lang="en"> <head> <title><?php echo $nds; ?></title> </head> <body> </body> </html> ...and here is the required PHP file (functions.php)... <? php // test variable $nds = 'Test title.'; ?> This gives me an "undefined variable" error when tested in a browser. Is this an issue of scope? Quote Link to post Share on other sites
dsonesuk 913 Posted July 15, 2016 Report Share Posted July 15, 2016 Remove space between '<?' and 'php' 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.