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

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.