yes, you can do this, but you have the order wrong.

you must set the variable before you use it.

and you must have double quotes around the variable in the define() call

single quotes denotes a literal string which will not include the value of a
variable, you would end up echo'ing  "Hello $var" instead of "Hello Dan"

$var = "Dan";

define('CONSTANT', "Hello $var");

echo CONSTANT

Jim Lucas

----- Original Message -----
From: "Dan Rossi" <[EMAIL PROTECTED]>
To: "Daniel Diehl" <[EMAIL PROTECTED]>; "'Php-General'"
<[EMAIL PROTECTED]>
Sent: Saturday, March 22, 2003 4:44 AM
Subject: RE: [PHP] variales within define constants


> ?? why would i not try it before posting heh :O
>
> -----Original Message-----
> From: Daniel Diehl [mailto:[EMAIL PROTECTED]
> Sent: Sunday, March 23, 2003 12:23 AM
> To: 'Dan Rossi'; 'Php-General'
> Subject: RE: [PHP] variales within define constants
>
>
> Just try it :)
>
> > -----Original Message-----
> > From: Dan Rossi [mailto:[EMAIL PROTECTED]
> > Sent: Samstag, 22. März 2003 08:09
> > To: Php-General
> > Subject: [PHP] variales within define constants
> >
> >
> > hi guys i'm sure i've done this before but is it possible ?
> >
> > i would like it to show up like this
> >
> > define('CONSTANT','Hello $var');
> >
> > $var = "Dan";
> >
> > echo CONSTANT
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to