Q:

Multiplication error in php

I'm building a site where people can exchange coins (site currency) into Bitcoin. The problem I'm having is that for some reason when I multiply the $btcprice with 3 or less the echo is really weird... for your sake this is the code that matters:
<?php
// get 0,01 usd in bitcoins into a variable
$btcprice = file_get_contents('https://blockchain.info/tobtc?currency=USD&value=0.01');
$valueInBTC = 4 * $btcprice;
echo $valueInBTC; 
?>

Anything that's 4 or higher will work, but if you try to multiply this with 3 or less it gets weird. For example this:
<?php
// get 0,01 usd in bitcoins into a variable
$btcprice = file_get_contents('https://blockchain.info/tobtc?currency=USD&value=0.01');
$valueInBTC = 3 * $btcprice;
echo $valueInBTC; 
?>

Will echo 7.959E-5
I just don't understand what the problem is...

A:

The result you are getting is not an error. It is simply in a formatting you don't expect / know yet. 7.959E-5is exactly the same as 0.00007959 it is just a different way of writing it down. Think of it as 7.959E-5 = 7.959 × (10 ^ (-5)) = 0.00007959. It is called Scientific notation (E notation). In cumputation / science this notation is used, because you can show very large or very small (as in your case) numbers with less digits (it is just shorter to write). 
To get the number in other formattings use the php function sprintf().
As you are handling bitcoin values, you shouldn't be formatiing the numbers until just for output. With bitcoins you always deal with very small numbers and you will soon meet precision problems if you try and calculate with formatted floating point numbers. 

