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 trialCarlos Chavira
401 PointsPHP 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.
<?php
//Place your code below this comment
?>
2 Answers
jamesjones21
9,260 PointsTask 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
401 PointsThank you James Jones!
jamesjones21
9,260 PointsNot 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
9,260 PointsThatβs how it should look like, best of luck.
<?php
//Place you code below this comment $integerOne = 1; $integerTwo = 2; $floatOne = 1.5; ?>
Antonio De Rose
20,885 PointsAntonio De Rose
20,885 PointsPlease 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