Level 55
<td>{{ $item->expire ? date('d F Y', strtotime($item->expire)) : '' }}</td>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
If I have code like this:
<td>{{date('d F Y', strtotime($item->expire))}}</td>
If "$item->expire" worth "Null" then the result will automatically be: 01 January 1970
How to fix it not showing or can it be replaced with a string value (eg "-")?
<td>{{ $item->expire ? date('d F Y', strtotime($item->expire)) : '' }}</td>
Please or to participate in this conversation.