views:

35

answers:

1

I have the following part of my xml:

<book number="AB 123" type="SCI"> <info> <type code="FIC"><![CDATA[Fiction]]></status> <publish-time><![CDATA[20090110214000]]></publish-time> </info> </book>

If i do: echo $key->info->type; I get nice and easy "Fiction"

BUT if i do: echo $key->info->publish-time; I get "0". I thought i has to do with this (20090110214000) being a number but i tried various ways to extract that but with no success. When i print_r i see the 20090110214000 just fine in there but why can i not get that value (as a number or string) to be echoed or assign it to a variable?

Any help?

A: 

What you do is $key->info->publish - time, basically a substraction of an undefined value minus an unknown constant (results in 0).

Use $key->info->{'publish-time'} to retrieve the correct value.

halfdan
Sweeeeeeeeeeeeet! Thanks a lot!!
Mark