Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi folk

I do this:

define("a1", "b");
echo a1
$y = 1;
$x = "a".$y
echo contant($x);

for the last line I get an error.  How can I fix this?



Re: constant

Quoted text here. Click to load it

Just check your spelling and punctuation!

define("a1", "b");
echo a1;
$y = 1;
$x = "a".$y;
echo constant($x);

It works.


Re: constant

Balazs Wellisch wrote:
Quoted text here. Click to load it

it was actually just an example.  In real life it is not working! It is a  
pretty old version of PHP, could that be it?  It does recognise constant as  
a function though.  It was all rather weird.  

Re: constant

Quoted text here. Click to load it

Constant() function is available since php 4.0.4

SETI @ Home - Donate your cpu's idle time to science.
Further reading at <

Re: constant

It could be a bug. Try defining the constant as case-insensitive and
see what happens. Got a dump on get_defined_constants() too.

Re: constant

You're missing a semicolon on the line before the last - this will give
an error on the last line.

Site Timeline