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 8763611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:49:07+00:00 2026-06-13T15:49:07+00:00

This is killing me! I’ve never had so much trouble and I can’t figure

  • 0

This is killing me! I’ve never had so much trouble and I can’t figure out what I’m doing wrong here.

If I have a number, say 2.32, and I want to do math with it it won’t work out. The very simplest example:

$income = $commission; //Commission is 2.32, retrieved from XML
echo "income: $income<br>";
$income100 = $income*100;
echo "income100: $income100<br>";

The result I get is:

income: 2.32
income100: 200

How can I use a decimal number accurately with math without it changing it?

Thanks so much!

  • 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-06-13T15:49:08+00:00Added an answer on June 13, 2026 at 3:49 pm

    You need to assign $income in the following manner to get rid of the underlying SimpleXMLElement:

    $income = (float) $commission;
    

    Example of what happens when you don’t:

    $x = simplexml_load_string("<a>2.4</a>");
    echo $x * 100; // output:  200
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay this is killing me, I can't figure out what I'm doing wrong I
I can't figure out IE7 float right bug! This is killing me. My NAV
Im killing the process in the port 4444, but this can change, i have
I have this type of exercise in jquery. Go here http://jsfiddle.net/LAntL/3/ For Item 1
this is killing me but is there any simple way to have objective-c code
This is KILLING me! I have a view. in the .h file i do
This one is killing me. I have a fairly complicated JavaScript routine fired by
This is killing me!!! I seem to have done all I need to do
This has been killing me for two days now. I have a main Activity
This has been killing me for two days now. I have a main Activity

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.