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

WIlliam Powell-Davis
WIlliam Powell-Davis
212 Points

How do you multiply the integer with another and display the value without changing the original value?

I cant see where the value can be displayed without affecting the original integer, please can someone review my code and see where I've made a mistake. Thank you

index.php
<?php

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

$integerOne = $integerOne + 5;
var_dump($integerOne);
$integerTwo = $integerTwo - 1;
var_dump($integerTwo);

$value = $floatOne * $integerOne 
echo "value: ";
echo $integerOne;
echo $floatOne;
?>

1 Answer

Patrik Horváth
Patrik Horváth
11,110 Points

simple just put aritmetical operation after echo :)

for example :

$var1 = 10;
$var2 = 10.5;

echo ($var1 * $var2); 

i hope you underestend :)

or more example :)

echo ((($var1 * $var2)-$var1+($var2/$var1)) % 2);