code: public static function prettyTimeToSeconds($time, $dayLength = 28800, $weekLength = 144000)
      {
          $minus = 0 === strpos($time, '-');
          if ($minus) {
              $time = substr($time, 1);
          }
          if (preg_match('/^(?:(?<weeks>\d+)w\s*)?(?:(?<days>\d+)d\s*)?(?:(?<hours>\d+)h\s*)?(?:(?<minutes>\d+)m\s*)?(?:(?<seconds>\d+)s\s*)?$/', $time, $matches)) {
              return
                  ($minus ? -1 : 1) *
                  (!empty($matches['weeks']) ? (int)$matches['weeks'] * $weekLength : 0) +
                  (!empty($matches['days']) ? (int)$matches['days'] * $dayLength : 0) +
                  (!empty($matches['hours']) ? (int)$matches['hours'] * 3600 : 0) +
                  (!empty($matches['minutes']) ? (int)$matches['minutes'] * 60 : 0) +
                  (!empty($matches['seconds']) ? (int)$matches['seconds'] : 0);
          }
  
          return 0;
      }
docs: Converts pretty time format (2w 1d 5h 30m) to seconds
  
  @param string $time Pretty time format
  @param int $dayLength Length of the work day in seconds
  @param int $weekLength Length of the work week is seconds
  @return int Time in seconds