PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, October 17, 2022

[FIXED] why gettype(10.5 + 10.5); returns double? not integer

 October 17, 2022     double, gettype, integer, php     No comments   

Issue

when I tried to

gettype(10.5 + 10.5);

it returns double or float but the summation of 10.5 + 10.5 = 21 which is actually an integer


Solution

gettype() is a function that lets you see the data type.

You add a double (10.5), and another double (10.5), you get yet another double (21.0), which is what the function returns you.

More details can be found here: https://www.php.net/manual/en/function.gettype.php



Answered By - Dennis Kozevnikoff
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing