如何将数字1显示为01以及如何增加该数字


how to display the number 1 as 01 and how to increment that

实际上我有如下的文本文件,...(file.txt)

;
; Message Information file
;
[message]
origmailbox=103
context=macro-vm
macrocontext=from-internal
exten=s-BUSY
rdnis=unknown
priority=3
callerchan=SIP/103-0000001a
callerid="103" <103>
origdate=Fri May  2 04:51:01 PM UTC 2014
origtime=1399049461
category=
flag=
duration=2

我需要在网页中显示这些内容。所以我使用

<?php
$data = file_get_contents(path,NULL,NULL,start,end);
echo $data;
?>

但是文本文件的最后一行"duration=2"并不好。我想以秒为单位显示持续时间,如"duration=0.02"。但是我不修改文本文件。

如何在网页上显示?

,如果文本文件有"duration=10",我想自动更改"duration=0.02"到"duration=0.10"在网页

请帮帮我

有点长,但能行

$values = file('filename.ext');
$search="duration";$data='';
foreach (array_values($values) AS $line)
{
list($key, $val) = explode('=', trim($line) );
if (trim($key) == $search)
    {
    $data .= $key.'='.($val/100);
}
else
{
$data .= $line;
}
}