nscherneck Posted July 15, 2016 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? Link to comment Share on other sites More sharing options...
dsonesuk Posted July 15, 2016 Share Posted July 15, 2016 Remove space between '<?' and 'php' 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now