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

Gonzalo Blasco
Gonzalo Blasco
11,927 Points

double vs float?

When it's explain gettype() the teacher said it's all about integers, floats, strings, arrays, booleans, objects and resources.

When I went into the link in Teacher's Notes, the page said it's all about integers, doubles, strings, arrays, booleans, objects, resources and NULL.

Is it mean the info in the video is not update? I know what NULL means, but what the h.ll is doubles? Where're my floats?...

2 Answers

Casey Ydenberg
Casey Ydenberg
15,622 Points

You can probably think of doubles and floats interchangeably. Basically, doubles dedicate twice as much memory to floating point numbers, but since PHP is loosely typed, the interpreter will either treat them the same (ie every float is really a double) or convert between them in a way you are never aware of as the programmer. The distinction matters more in languages like Python or Java.