我有一個php腳本,我需要將日期格式從CYYMMDD更新為MM/DD/YYYY,我寫了一個函數(shù)來幫我做這個,但是當(dāng)我打印它時,結(jié)果顯示為'Array'。
//將日期格式從CYYMMDD修改為MM/DD/YY function getDate(string $iDATE){ $iDay = substr($iDATE,5,2); $iMonth = substr($iDATE,3,2); $iYear = substr($iDATE,1,2); $iDATE = $iMonth . "/" . $iDay . "/" . $iYear; RETURN $iDATE; }
這是我嘗試從中調(diào)用函數(shù)的代碼行:
print "<td align='left' class='Col2'><font face='Calibri' size='3'>".getDate($iDATE)."</td>";
輸出:Array
有什么想法嗎?
getdate是一個預(yù)定義的PHP函數(shù),它返回一個數(shù)組 https://www.php.net/manual/en/function.getdate.php
你應(yīng)該重新命名你的函數(shù)或?qū)⑵浞庋b在一個命名空間中。