public function timeLeft(int $timestamp, bool $Left = true): string
    {
        $diff = $bLeft == true ? time() - $timestamp : $timestamp;
        
        $showdiff = [
            "y" => 0,
            "m" => 0,
            "w" => 0,
            "d" => 0,
            "h" => 0,
            "min" => 0
        ];
        
        while ($diff >= 31536000) {
            // 1 year = 31536000 seconds
            $diff -= 31536000;
            $showdiff['y'] ++;
        }
        while ($diff >= 2419200) {
            // 1 day = 2592000 seconds
            $diff -= 2419200;
            $showdiff['m'] ++;
        }
        while ($diff >= 648000) {
            // 1 week = 604800 seconds
            $diff -= 648000;
            $showdiff['w'] ++;
        }
        
        while ($diff >= 86400) {
            // 1 day = 86400 seconds
            $diff -= 86400;
            $showdiff['d'] ++;
        }
        
        while ($diff >= 3600) {
            // 1 hour = 3600 seconds
            $diff -= 3600;
            $showdiff['h'] ++;
        }
        
        while ($diff >= 60) {
            // 1 minute = 60 seconds
            $diff -= 60;
            $showdiff['min'] ++;
        }
        
        return $showdiff;
    }
public function timeLeft(int $timestamp, bool $Left = true): string
    {
        $diff = $bLeft == true ? time() - $timestamp : $timestamp;
        
        $showdiff = [
            "y" => 0,
            "m" => 0,
            "w" => 0,
            "d" => 0,
            "h" => 0,
            "min" => 0
        ];
        
        while ($diff >= 31536000) {
            // 1 year = 31536000 seconds
            $diff -= 31536000;
            $showdiff['y'] ++;
        }
        while ($diff >= 2419200) {
            // 1 day = 2592000 seconds
            $diff -= 2419200;
            $showdiff['m'] ++;
        }
        while ($diff >= 648000) {
            // 1 week = 604800 seconds
            $diff -= 648000;
            $showdiff['w'] ++;
        }
        
        while ($diff >= 86400) {
            // 1 day = 86400 seconds
            $diff -= 86400;
            $showdiff['d'] ++;
        }
        
        while ($diff >= 3600) {
            // 1 hour = 3600 seconds
            $diff -= 3600;
            $showdiff['h'] ++;
        }
        
        while ($diff >= 60) {
            // 1 minute = 60 seconds
            $diff -= 60;
            $showdiff['min'] ++;
        }
        
        return $showdiff;
    }
public function timeLeft ( int $ timestamp , bool $ Left = true ) : string { $ diff = $ bLeft == true ? time ( ) - $ timestamp : $ timestamp ; $ showdiff = [ "y" => 0 , "m" => 0 , "w" => 0 , "d" => 0 , "h" => 0 , "min" => 0 ] ; while ( $ diff >= 31536000 ) { // 1 year = 31536000 seconds $ diff -= 31536000 ; $ showdiff [ 'y' ] ++ ; } while ( $ diff >= 2419200 ) { // 1 day = 2592000 seconds $ diff -= 2419200 ; $ showdiff [ 'm' ] ++ ; } while ( $ diff >= 648000 ) { // 1 week = 604800 seconds $ diff -= 648000 ; $ showdiff [ 'w' ] ++ ; } while ( $ diff >= 86400 ) { // 1 day = 86400 seconds $ diff -= 86400 ; $ showdiff [ 'd' ] ++ ; } while ( $ diff >= 3600 ) { // 1 hour = 3600 seconds $ diff -= 3600 ; $ showdiff [ 'h' ] ++ ; } while ( $ diff >= 60 ) { // 1 minute = 60 seconds $ diff -= 60 ; $ showdiff [ 'min' ] ++ ; } return $ showdiff ; }
Calculates time left from an timestamp in the future

@param int $timestamp
@param bool $left

@return string
Calculates time left from an timestamp in the future