jeudi 12 septembre 2019

I want to divide by the integer type and round off the existing decimal point

I want to divide by the integer type and truncate after the decimal point. DB column is integer

Below is the code

public static function time($time)
{
    $h = $time/60;
    floor($h);
    $m = $time%60;
    return $h . ':' . $m; 
}

When $ h is seen with dd, it comes out like this

1.1666666666667

How can I truncate after the decimal point?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/31iQbl9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire