Complete Global Variable in PHP

They have: 426 posts

Joined: Feb 2005

I want to add my script URL, for example example.com and put it into a completly global variabe accessible by files more than 1 0r two direcotries deep. Is this possible, if not, is there a global variable like

$_SERVER['DOCUMENT_ROOT'] but exists for the actual URL not the directory structure?

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

I'm not completely sure what you're trying to do, but it may be something that a session variable can do. Check out this link for some info:

http://www.smallbizonline.co.uk/php_session_variables.php

They have: 426 posts

Joined: Feb 2005

No its ok, i manages to just include a file instead. I was only wandering if it was possible to declare a variable as a global type that is accessible from any directory without having to include the file.

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

Ah, okay. Yes, a session variable will do just that, but it's different for each visitor to the web site.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.