[PHP] variales within define constants

2003-03-22 Thread Dan Rossi
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



RE: [PHP] variales within define constants

2003-03-22 Thread Daniel Diehl
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



RE: [PHP] variales within define constants

2003-03-22 Thread Dan Rossi
?? 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



Re: [PHP] variales within define constants

2003-03-22 Thread Jim Lucas
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



RE: [PHP] variales within define constants

2003-03-22 Thread Dan Rossi
hmm there is a problem, i set my defines in a defines.php file , i place it
right at the top of my main includes file , which sets the paths for other
include files , i have my funtion within a class , so the order is

include(defines.php);
include(class.php);

$class = new class;

would it work if it switch it ?



include(class.php);

$class = new class;
include(defines.php);

the variable is set within the class , its an internal variable ie
$this-_variable;


-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 23, 2003 3:43 AM
To: Dan Rossi; Daniel Diehl; 'Php-General'
Subject: Re: [PHP] variales within define constants


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



RE: [PHP] variales within define constants

2003-03-22 Thread Dan Rossi
ok i need to e able to predefine messages in a settings file , but need
dynamic variables to print out , the variables are within a class ,
basically i want the message settings seperate from the class itself so they
are configurable, this is mostly need for when emailing messages , i need to
be able to go Hello $username or Hello $this-username for example , is
there any way to do this ?

-Original Message-
From: Dan Rossi [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 23, 2003 9:09 AM
To: Jim Lucas; Daniel Diehl; 'Php-General'
Subject: RE: [PHP] variales within define constants


hmm there is a problem, i set my defines in a defines.php file , i place it
right at the top of my main includes file , which sets the paths for other
include files , i have my funtion within a class , so the order is

include(defines.php);
include(class.php);

$class = new class;

would it work if it switch it ?



include(class.php);

$class = new class;
include(defines.php);

the variable is set within the class , its an internal variable ie
$this-_variable;


-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 23, 2003 3:43 AM
To: Dan Rossi; Daniel Diehl; 'Php-General'
Subject: Re: [PHP] variales within define constants


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


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