Getting information from an XML object in PHP
Posted
by errata
on Stack Overflow
See other posts from Stack Overflow
or by errata
Published on 2010-06-18T10:37:51Z
Indexed on
2010/06/18
10:43 UTC
Read the original article
Hit count: 199
Hi!
I am using some XML parser to get some information from API, blah blah... :)
In one place in my script, I need to convert string to int but I'm not sure how...
Here is my object:
object(parserXMLElement)#45 (4) {
["name:private"]=>
string(7) "balance"
["data:private"]=>
object(SimpleXMLElement)#46 (1) {
[0]=>
string(12) "11426.46"
}
["children:private"]=>
NULL
["rows:private"]=>
NULL
}
I need to have this string "11426.46" stored in some var as integer.
When I echo $parsed->result->balance
I get that string, but if I want to cast it as int, the result is: 1.
Please help!
Thanks a lot!
© Stack Overflow or respective owner