Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Basics Unit Converter Manipulating Numbers

operators

how do i multiply a float by an integer which has already been applied an arithmetic operator to get challenge three right

index.php
<?php

//Place your code below this comment
$integerOne = 1;
$integerTwo = 2;


  var_dump ($integerOne + 5);

  $integerTwo = --$integerTwo;
var_dump ($integerTwo);

$floatOne = 1.5;
var_dump ($integerOne * $floatOne);
?>

1 Answer

Algirdas Lalys
Algirdas Lalys
9,389 Points

Hi Kumbirai Ruth Huni,

Well if you are trying to pass this challenge you shouldn't use var_dump() function it's ussually for testing purposes. For the first task you have done well, You have assign values to $integerOne and $integerTwo

<?php

//Place your code below this comment

// Assigned values to variable $integerOne and $integerTwo
$integerOne = 1;
$integerTwo = 2;
?>

For the Task 2 it asks to Add 5 to $integerOne. Subtract 1 from $integerTwo. Which is something like this.

<?php

//Place your code below this comment

// Assigned values to variable $integerOne and $integerTwo
$integerOne = 1;
$integerTwo = 2;

// Add 5 to $integerOne
$integerOne += 5;

// Subtract 1 from $integerTwo
$integerTwo -= 1;
?>

And lastly Task 3 asks us to Create a New Float Variable named $floatOne with a value of 1.5. Without changing the value of $integerOne or $floatOne, multiply $integerOne by $floatOne and display the results. Which is something like this.

<?php

//Place your code below this comment

// Assigned values to variable $integerOne and $integerTwo
$integerOne = 1;
$integerTwo = 2;

// Add 5 to $integerOne
$integerOne += 5;

// Subtract 1 from $integerTwo
$integerTwo -= 1;

// New float varaible $floatOne with a value of 1.5
$floatOne = 1.5;

// Without changing the value of $integerOne or $floatOne, multiply $integerOne by $floatOne and display the results
echo $integerOne * $floatOne;

// You can check your displayed value by pressing "Preview" button which is in right top corner next to "Check Work" and "Get Help"
// Because you are using "echo" command you can actually see results in preview.
?>

I hope this helps you to better understand this challenge.