0
我有一个返回'1970-01-01'为空值的日期字段。所以,我想创建一个三元运算符的变量$from
.Still返回1970-01-01.What我做错了变量的三元运算符
$from=$asset_other_details->start_date; //1970-01-01
$from == '1970-01-01' ? '' : $from ;
我有一个返回'1970-01-01'为空值的日期字段。所以,我想创建一个三元运算符的变量$from
.Still返回1970-01-01.What我做错了变量的三元运算符
$from=$asset_other_details->start_date; //1970-01-01
$from == '1970-01-01' ? '' : $from ;
你必须基于像下面的比较输出新的值赋给$form
: -
$from = $asset_other_details->start_date; //1970-01-01
$from = ($from == '1970-01-01') ? '' : $from ;
输出了解: - https://eval.in/867743
你不分配$from
新的价值。请尝试以下操作:
$from = ($asset_other_details->start_date == '1970-01-01') ? '' : $asset_other_details->start_date;
检查我给 – user3386779
你不重新分配的确切文字'from' – msfoster
做它的分配。 – chris85