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 PHP Constants

No quotes for numbers constant

In this video Paulk doesn't use quotes for the numbers while for the text yes. Why?

Es:

<?php
define("YEAR", 2015);
define("JOB_TITLE", "Teacher")
define("MAX_BADGES", 150000);
?>

Thanks

2 Answers

Samuel Webb
Samuel Webb
25,370 Points

If he would have used quotes on the numbers they would be a string(type) instead of an integer(type). Booleans and Floats are two other types you wouldn't use quotes for.

Strings would be used for a word or sentence. While integers and floats(decimal numbers) would be used for math and other things you would use a number for.

Thank you Samuel!

-Dario