Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 875979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:21:34+00:00 2026-05-15T11:21:34+00:00

I am using some XML parser to get some information from API, blah blah…

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:21:35+00:00Added an answer on May 15, 2026 at 11:21 am

    you have an object, intval of an object will always be 1(if it doesnt have a __toString() magic method defined).
    you can intval SimpleXMLElement and it will return 11426, but to do that, the data member of the parserXMLElement class has to be public. you might need to define a getData() method for the parserXMLElement class or make the data member public.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 497k
  • Answers 497k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You may want to follow a course on relational database… May 16, 2026 at 11:54 am
  • Editorial Team
    Editorial Team added an answer If I understand your requirement, you want to match if… May 16, 2026 at 11:54 am
  • Editorial Team
    Editorial Team added an answer First of all you have problem with quotes in the… May 16, 2026 at 11:54 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm loading from a xml some information about city's points of interest, and my
I'm using XML to send project information between applications. One of the pieces of
I'm using the SAX xml parser to parse some xml data which contains newlines.
I’m using Linq to extract values from some XML. Shown below is a simplified
I'm using jQuery to setup an Ajax request that grabs an XML feed from
Today I am looking into how to make a simple XML parser in Cocoa
I'm using jqGrid to display the results of a database query. The php script
When upgrading from libxml2 2.6 to 2.7, some behavior changed for me. I've located
I'm trying to lock down PowerPoint and I can get rid of some of
I have some XML data which includes URIs. I want to list the URIs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.