PHP function output shows as Array instead of expected value
P粉722409996
P粉722409996 2024-02-04 11:38:12
0
1
790

I have a php script and I need to update the date format from CYYMMDD to MM/DD/YYYY, I wrote a function to do this for me, but when I print it, the result is displayed as an '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;
}

This is the line of code I'm trying to call the function from:

print "<td align='left' class='Col2'><font face='Calibri' size='3'>".getDate($iDATE)."</td>";

Output: Array

Any ideas?

P粉722409996
P粉722409996

reply all(1)
P粉071559609

getdate is a predefined PHP function that returns an array https://www.php.net/manual/en/function.getdate.php

You should rename your function or encapsulate it in a namespace.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template