function secondsToReadableFormat($seconds, $dateFormat, $units, $separator, $precision) { $date = gmdate($dateFormat, $seconds); $dates = array_map('intval', explode($separator, $date)); $dates[count($dates) - 1] .= getDecimalPart($seconds, $precision); $nonZeroDates = array_filter($dates, 'ProfilerTools\\greaterThatZero'); if ($nonZeroDates) { $datesWithUnits = addUnits($nonZeroDates, $units); return implode($datesWithUnits, $separator); } return getZeroSeconds($units); }
<?php function getDecimalPart($number) { $whole = floor($number); $decimal = $number - $whole; //take off '.' $decimal = explode('.', $decimal)[1]; echo $decimal; } function lookForRepetition($decimal) { } getDecimalPart(1 / 7);