이 코드 :sprintf가 서식이 지정된 문자열 대신 별표를 사용하는 이유는 무엇입니까?
function atest(){
$test = array(
"StartDate" => "08/01/2013",
"StartTime" =>"08:00:00",
"DepartmentID" => "75275",
"# Contacts Offered" => "3",
"# Contacts Handled" => "4",
"Average Talk Time" => "491.250000",
"Average Delay" => "5.666667",
"Percent SLA" => "1.333333");
$formatted = sprintf("%s %s TCSDATA %d %d %d %01.2f 0 %01.2f %01.2f 0\r\n",
$test["StartDate"],
$test["StartTime"],
$test['DepartmentID'],
$test['# Contacts Offered'],
$test['# Contacts Handled'],
$test['Average Talk Time'],
$test['Average Delay'],
$test['Percent SLA']
);
echo('<pre>');
echo(var_dump($test));
echo('</pre>');
echo $formatted;
}
인쇄이 : 그러나
08/01/2013 08:00:00 TCSDATA 75275 ************************
, 나는 같은 마지막 0을 제거하기 위해 sprintf와 형식을 수정하는 경우 :
:"%s %s TCSDATA %d %d %d %01.2f 0 %01.2f %01.2f \r\n"
내가이 얻을
08/01/2013 08:00:00 TCSDATA 75275 3 4 491.25 0 5.67 1.33
세계에서 무엇입니까?
어떤 PHP 버전을 사용하고 있습니까? (가능하다면 패치 버전까지)? –
5.3.2, 패치 버전을 얻는 방법을 모르겠다 – JustinY17
'PHPINFO();'는 패치 – DevlshOne