ID: 10801
Updated by: cynic
Status: Bogus
Bug Type: Variables related
Operating system: 
PHP Version: 4.0.4
Assigned To: 

there _is_ such an interface:

Previous Comments:

[2001-05-10 19:13:10] [EMAIL PROTECTED]
I'm not trying to change the constant value, but there
should be an interface for referencing constants similar to
how variables can be added.

If I have constants called:  MY_CONSTANT_1 and MY_CONSTANT_2

I should be about to form a variable that reference those
names like:



print $$thisConst;

print $$thisConst;

That would output:


[2001-05-10 18:56:56] [EMAIL PROTECTED]
it's variable variables, not variable constants.
what bug are you reporting? I haven't noticed.


[2001-05-10 18:11:18] [EMAIL PROTECTED]
Variable variables techniques do not work when one of the
"variables" is a constant. The example below illustrates
this. This is probably the desired behavior for constants,
but was confusing for me when I was trying to figure it out.
The alternative I used was to add the variables I needed to
the $GLOBALS array instead of defining them as constants.



function connectTo($databaseName){
global $DB_Z_NAME;

return """.${$fullDatabaseName}.""";


print "DB_X_NAME is ".connectTo("X")."
print "DB_Y_NAME is ".connectTo("Y")."
print "DB_Z_NAME is ".connectTo("Z")."



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to