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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
cheechm Posted November 21, 2007 Author Share Posted November 21, 2007 Did and didn't work. Quote Link to comment 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."" ) Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Wes1890 Posted November 21, 2007 Share Posted November 21, 2007 No problem my friend Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.