Sunday, November 15, 2009

string to attribute name in PHP classs

Posted on 4:26 PM by programlover









Hi



This works fine:


php Code:
echo $xml -> value;

but this doesn't:


php Code:
$v = "value";
echo $xml -> $v;

I'd get this error:

Notice: Array to string conversion in...



How can I change that string so php interprets it to an attribute name?