Getting information from an XML object in PHP -


I am using some XML parser to get some information from API ... blah blah ... .. .)

In one place in my script, I need to convert the string to int but I'm not sure how ...

This is my object:

  object (parserXMLElement) # 45 (4) {["name: personal"] => String (7) "Balance" ["Data: Private"] = & gt; Object (simple assemment) # 46 (1) {[0] = & gt; String (12) "11426.46"} ["children: private"] = & gt; Zero ["lines: private"] = & gt; NULL}  

I need to have string stored in the form of integer "11426.46" in some strings.
When I $ parse-> gt; Result-> Balance I get that string, but if I want to put it in the form of integer, the result is: 1.

Please help! Thanks a lot!

You have an object, the object's interval will always be 1 (if there are any __string () magic method in it is not defined). You can intave SimpleXMlelement and it will return 11426, but to do so, the data member of the parserXMLElement class should be public. You may need to define a getData () method for the parserXMLElement class or make the data subscriber public.


Comments