cheechm Posted November 21, 2007 Share Posted November 21, 2007 Can you use a defined variable in an array in php? EG: 'welcome' => "Welcome to the official website of "SITE_NAME, Thanks Link to comment https://forums.phpfreaks.com/topic/78279-solved-using-defined-variables/ Share on other sites More sharing options...
PHP_PhREEEk Posted November 21, 2007 Share Posted November 21, 2007 Did you try it? Seems simple enough to at least give it a run... PhREEEk Link to comment https://forums.phpfreaks.com/topic/78279-solved-using-defined-variables/#findComment-396140 Share on other sites More sharing options...
cheechm Posted November 21, 2007 Author Share Posted November 21, 2007 Did and didn't work. Link to comment https://forums.phpfreaks.com/topic/78279-solved-using-defined-variables/#findComment-396152 Share on other sites More sharing options...
Wes1890 Posted November 21, 2007 Share Posted November 21, 2007 Try array( 'welcome' => "Welcome to the official website of ".SITE_NAME ) (i added a period (.) before the defined VAR) or array( 'welcome' => "Welcome to the official website of ".SITE_NAME."" ) Link to comment https://forums.phpfreaks.com/topic/78279-solved-using-defined-variables/#findComment-396156 Share on other sites More sharing options...
Glyde Posted November 21, 2007 Share Posted November 21, 2007 <?php define("SITE_NAME", "My Website"); print "Welcome to the official website of " . SITE_NAME; ?> Additionally, you can try the following: <?php $name = $_GET['site_name']; print "Welcome to the official website of " . $name; ?> Just access your page via yourpage.php?site_name=website Link to comment https://forums.phpfreaks.com/topic/78279-solved-using-defined-variables/#findComment-396160 Share on other sites More sharing options...
cheechm Posted November 21, 2007 Author Share Posted November 21, 2007 Try array( 'welcome' => "Welcome to the official website of ".SITE_NAME ) (i added a period (.) before the defined VAR) Worked. Thanks Link to comment https://forums.phpfreaks.com/topic/78279-solved-using-defined-variables/#findComment-396299 Share on other sites More sharing options...
Wes1890 Posted November 21, 2007 Share Posted November 21, 2007 No problem my friend Link to comment https://forums.phpfreaks.com/topic/78279-solved-using-defined-variables/#findComment-396300 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.