PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hello all
I declare a variable in a file "config.inc" in a folder called "inc" as:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
If it is a value that never changes throughout the lifetime of your script, such as a database name or password or something, then use a constant. Check out the documentation for define().
Avoid using constants for (database) credentials. Since they cannot be destroyed, any malicious code introduced through a vulnerability would allow the attacker to gain access to its contents.