Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* PHP Script
- PHP Time Ago
- Created By Wildan Izzudin.
- (c) 2019 Underxploit
- */
- function yl($str) {
- $est = time() - $str;
- if ($est < 1) {
- return 'kurang dari 1 detik';
- }
- $def = array(
- 12 * 30 * 24 * 60 * 60 => 'tahun',
- 30 * 24 * 60 * 60 => 'bulan',
- 24 * 60 * 60 => 'hari',
- 60 * 60 => 'jam',
- 60 => 'menit',
- 1 => 'detik'
- );
- foreach($def as $secs => $str) {
- $d = $est / $secs;
- if ($d >= 1) {
- $r = round($d);
- return $r . ' ' . $str . ($r > 1 ? '' : '') . ' yang lalu';
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement