2011-09-10 46 views
0
function countdown($month, $day, $year) 
{ 
    return ceil((mktime(0,0,0,$month,$day,$year) - time())/86400); 
} 
class dates 
{ 
    public $month; 
    public $day; 
    public $year; 
} 
$exp = new dates; 

echo countdown($exp->month, $exp->day, $exp->year); 

*解析错误:语法错误,在/ var意外T_STRING/WWW/PFN/*PHP:变量传递给函数(类)

刚学PHP,试图用一个PHP类作为C结构,但由于某种原因,我不能将这些变量传递给函数,为什么这是?

回答

3

删除$标志$return

function countdown($month, $day, $year) 
{ 
    return ceil((mktime(0,0,0,$month,$day,$year) - time())/86400); 
} 
+0

*刘海靠在墙上* – dukevin