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 Unit Converter Manipulating Numbers

Carlos Chavira
Carlos Chavira
401 Points

PHP challenge task 1 of 3

I am stuck on the following challenge:

"Create Two Integer Variables - The first will be named $integerOne with a value of 1 and the second will be named $integerTwo with a value of 2 Create a New Float Variable named $floatOne with a value of 1.5. "

I am unable to proceed until the task(s) are completed.

index.php
<?php

//Place your code below this comment

?>
Antonio De Rose
Antonio De Rose
20,885 Points

Please try take a start, try achieve something, and post us the code, you have tried, we can help you, need not have to be right, but the effort, that you take, to try the tasks

2 Answers

jamesjones21
jamesjones21
9,260 Points

Task two will look like this:

$integerOne = 1; $integerOne = 6; $integerTwo = 2; $integerTwo = 1; $floatOne = 1.5;

Then task 3 you multiply integerOne with floatOne

Happy coding

Carlos Chavira
Carlos Chavira
401 Points

Thank you James Jones!

jamesjones21
jamesjones21
9,260 Points

Not a problem Carlos. If you have a variable the same name as the above variable, it will be overwritten by the one underneath.

$var1 = 1;
$var1 = 2;

//output will be 2, due to the second declared $var1 will hold 2.
echo $var1;
jamesjones21
jamesjones21
9,260 Points

That’s how it should look like, best of luck.

<?php

//Place you code below this comment $integerOne = 1; $integerTwo = 2; $floatOne = 1.5; ?>