define() use in strings

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!

Moderator: General Moderators

Post Reply
blueherring
Forum Newbie
Posts: 1
Joined: Fri Dec 15, 2006 12:44 pm

define() use in strings

Post by blueherring »

I'd like to define values that are expanded inside strings, for example:

define("EXPAND_THIS","Expanded Stuff");

echo(" Here comes the stuff EXPAND_THIS");

Is there any way to do this?

Thanks

BH
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: define() use in strings

Post by Kieran Huggins »

You could remove it from the quotes:

Code: Select all

define("EXPAND_THIS","Expanded Stuff");

echo(" Here comes the stuff ".EXPAND_THIS);
Cheers,
Kieran
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Post Reply