6.1E-5 into a real decimal number

When I do some math, a decimal number turns into something like this:
6.1E-5
LVL 16
hankknightAsked:
Who is Participating?
 
clampsCommented:
like this?
$log = trim('
10:56:46.344794 <= Recv header, 17 bytes (0x11)
10:56:46.344855 <= Recv header, 36 bytes (0x24)
10:56:46.344889 <= Recv header, 25 bytes (0x19)
');

convertLog($log);

function convertLog ($str) {
 $v=0;
 foreach(preg_split("/(\r?\n)/", $str) as $line){
    $vv=$v;
    $pos = strpos($line, ' ');
    $dotpos = 1+strpos($line, '.');
    $v = strtotime(substr($line,0,$pos)) . substr($line,$dotpos,$pos-$dotpos) * 0.000001;
    echo '<h1>'; 
    printf("%f", round($v - $vv,6));
    echo '</h1>';
 }

}

Open in new window

0
 
clampsCommented:
printf("%.15f", $yourfloatvariableorcalculationhere);
0
 
hankknightAuthor Commented:
How can I use that in my code below?
<?php

$log = trim('
10:56:46.344794 <= Recv header, 17 bytes (0x11)
10:56:46.344855 <= Recv header, 36 bytes (0x24)
10:56:46.344889 <= Recv header, 25 bytes (0x19)
');

convertLog($log);

function convertLog ($str) {
 $v=0;
 foreach(preg_split("/(\r?\n)/", $str) as $line){
    $vv=$v;
    $pos = strpos($line, ' ');
    $dotpos = 1+strpos($line, '.');
    $v = strtotime(substr($line,0,$pos)) . substr($line,$dotpos,$pos-$dotpos) * 0.000001;
    echo '<h1>'. round($v - $vv,6) . '</h1>';
 }

}

?>

Open in new window

0
 
clampsCommented:
or just printf("%f", $yourfloatvariableorcalculationhere);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.