I am finding myself in a bit of a problem.
I have two anonymous functions and one calls the other.
But when the function $fCompleteDate is called within the function $fFindAndCreateDate
I get the fatal error of:
Function name must be a string.
The function $fFindAndCreateDate is called later on in the script.
I have literally no idea what the problem is.
$fCompleteDate = function($sDate)
{
$sDate = str_replace('/', '-', $sDate);
return str_repeat('01-', max(0, 2 - substr_count($sDate, '-'))) . $sDate;
};
$fFindAndCreateDate = function($aStruct)
{
$aDateStructNames = array('', 'Remark', 'Formatted', 'Extra');
foreach($aDateStructNames as $sDateStructName)
{
echo $fCompleteDate('2001');
echo 'a : '. $fCompleteDate($aStruct['startDate'.$sDateStructName]);
echo 'b : '. $fCompleteDate($aStruct['endDate'.$sDateStructName]);
}
};