3v4l.org

run code in 300+ PHP versions simultaneously
<?php $last_gdate = "2018-07-23 00:01:02"; $d_start = new DateTime('now'); $d_end = new DateTime($last_gdate); $d_dif = $d_start->diff($d_end); var_export($d_dif); $d_d = $d_dif->days; $d_h = $d_dif->h; $d_m = $d_dif->i; if ($d_d < 1) { if ($d_h < 1) { $d_since = $d_m . "m"; } else { $d_since = $d_h . "h"; } } else { $d_since = $d_d . "d"; } echo "\n$d_since";

preferences:
159.87 ms | 404 KiB | 5 Q