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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:05:54+00:00 2026-05-26T11:05:54+00:00

In my PHP code I have a variable that corresponds to the sum and

  • 0

In my PHP code I have a variable that corresponds to the sum and difference of some values obtained ​​from a MySQL database. This is the code:

<?php echo $verifica = (($valoreEntrate + $valoreInCassa) - ($valoreUscite + $valorePagamentiInSospeso + $valoreDaLasciareInCassa + $valoreDaPortareACasa)); ?>

Here is values of all variables involved obtained with echo:

$valoreEntrate = 3837.67
$valoreInCassa = 612.10
$valoreUscite = 97.81
$valorePagamentiInSospeso = 0
$valoreDaLasciareInCassa = 617.80
$valoreDaPortareACasa = 3734.22

The value of $verifica is:

$verifica = -0.0599999999995

Instead of -0.6 like I expected…
Can anyone explain why this value?
Thank you so much!!!
Bye…

  • 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-26T11:05:55+00:00Added an answer on May 26, 2026 at 11:05 am

    This is because they are float types, and floats are not stored as exact numbers. See PHP’s entry on float for further information.

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

Sidebar

Related Questions

If I have a variable that contains PHP code... something like this: $PageCode =
So I have some PHP code that looks like: $message = 'Here is the
I have some PHP code that generates dynamic tables of data on the fly.
I have some PHP code that is designed to make a spreadsheet with formulas
We have a list of dates that is drawn from a MySQL database. That
I'd like to have a form that executes some php code without having to
How can I determine using PHP code that, for example, I have a variable
In my PHP code I have a date in my variable $postedDate. Now I
This is my php code (I already have a connection to the db): $result
here is my mysql and php code layout: I have 3 tables tableA stores

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.