corillo181 Posted February 3, 2008 Share Posted February 3, 2008 hey i'm trying to fine what are some variables you would consider a must define.. example, i wastrying to make a define that always takes my to the root of my website. i try define(__ROOT__,$_SERVER['HTTP_HOST']); but this root doesnt work. can anyone help me. thank you. if you want to include any define that you use often please let me know about it, i am building a large website so any shortcuts for later use would be of great help. Link to comment https://forums.phpfreaks.com/topic/89196-essensial-defines/ Share on other sites More sharing options...
PHP Monkeh Posted February 3, 2008 Share Posted February 3, 2008 Try putting ' around your __ROOT__, e.g.: <?php define('__ROOT__', $_SERVER['HTTP_HOST']); ?> Then you can use __ROOT__ Link to comment https://forums.phpfreaks.com/topic/89196-essensial-defines/#findComment-456751 Share on other sites More sharing options...
trq Posted February 3, 2008 Share Posted February 3, 2008 The first perameter expected by the define function is a string. To make your code valid would require it to be... <?php define("__ROOT__", $_SERVER['HTTP_HOST']); // then to use your newly created constant. echo __ROOT__; ?> I would not however recommend naming constants with __CONSTNAME__ as these are typically reserved for use as php defined magic constants. Link to comment https://forums.phpfreaks.com/topic/89196-essensial-defines/#findComment-456752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.