I am stumped or just gone brain dead.
I have a class that returns a single value for each function called. eg
class DateClass {
function Get_Trans_TS() {
$this->Timestamp_Now = gmmktime(gmdate('H'), gmdate('i'), gmdate('s'), gmdate('n'), gmdate('j'), gmdate('Y'));
}
}
$TransTS = new DateClass;
$TransTS->Get_Trans_TS();
echo $TransTS->Timestamp_Now;
What I am stumped with if I combined the function in the class to return array of date timestamps so save having to make loads of object calls eg
class DateClass {
function Get_Trans_TS() {
$Trans_TS_Array = array();
$Trans_TS_Array['Timestamp_Now'] = gmmktime(gmdate('H'), gmdate('i'), gmdate('s'), gmdate('n'), gmdate('j'), gmdate('Y'));
$Trans_TS_Array['Timestamp_Tomorrow'] = gmmktime(gmdate('H'), gmdate('i'), gmdate('s'), gmdate('n') + 1, gmdate('j'), gmdate('Y'));
return $Trans_TS_Array;
}
}
How would I access the returned variables from the array or am I doing it wrong in the function?.
I have tried this but it fails, in fact I have tried many different ways but it's keeps failing.
$TransTS = new DateClass;
$TransTS->Get_Trans_TS();
echo $TransTS->Timestamp_Now;
echo $TransTS->Timestamp_Tomorrow;
Please shine a light for me to see. Thanks