Re: SimpleXML - issue with getting data out of the object returned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tim-Hinnerk Heuer

http://www.ihostnz.com


On Fri, Dec 19, 2008 at 3:50 PM, Dan Joseph <dmjoseph@xxxxxxxxx> wrote:

> Hi,
>
> I have a basic XML document that I am grabbing with
> simplexml_load_string(),
> here is the print_r:
>
> SimpleXMLElement Object
> (
>    [Package] => SimpleXMLElement Object
>        (
>            [PackageID] => 804
>            [PackageName] => Silver
>            [BandwidthGB] => 20
>            [WebStorageMB] => 5120
>            [DBStorageMB] => 250
>            [POPMailBoxes] => 50
>            [WebStorageUnits] => 5
>            [BandwidthUnits] => 1
>            [DBStorageUnits] => 1
>            [POPUnits] => 5
>            [DomainHeaders] => 50
>            [DBType] => MSSQL
>            [OSType] => Windows
>            [Enabled] => True
>        )
>
>    [Count] => 1
> )
>
> When I try and access $x->Package->PackageID I don't get 804, I get:
>
> SimpleXMLElement Object
>        (
>            [0] => 804
>        )
>
Had that problem before:
$val = (string) $x->Package->PackageID;
or
$val = (int) $x->Package->PackageID;

or whatever type you want. ;)

>
> Could someone tell me how I just get the value 804 out of there?
>
> --
> -Dan Joseph
>
> www.canishosting.com - Plans start @ $1.99/month.
>
> "Build a man a fire, and he will be warm for the rest of the day.
> Light a man on fire, and will be warm for the rest of his life."
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux