Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Basics (Retired) PHP Datatypes Integers

Timur Uzel
PLUS
Timur Uzel
Courses Plus Student 3,383 Points

When i gettype(1.1) it returns a double, not a float. Why is this?

When I type in...

<?php echo gettype(1.1) ?>

it returns a double, not a float.

2 Answers

Adam Young
Adam Young
15,791 Points

From http://php.net/manual/en/function.gettype.php:

"double" (for historical reasons "double" is returned in case of a float, and not simply "float")

In PHP, at least, a float and double are the same datatype.

Gonzalo Blasco
Gonzalo Blasco
11,927 Points

It looks doubles is the new float...