Re: SimpleXML - issue with getting data out of the object returned
| From: | German Geek | Date: | Fri, 19 Dec 2008 03:01:24 +0000 |
| Subject: | Re: SimpleXML - issue with getting data out of the object returned | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284812@lists.php.net to get a copy of this message | ||
Tim-Hinnerk Heuer
http://www.ihostnz.com
On Fri, Dec 19, 2008 at 3:50 PM, Dan Joseph <dmjoseph@gmail.com> 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."
>