function get_folder_time_from_url($url) { preg_match('@[0-9]{4}/[0-9]{2}@', $url, $matches); if (isset($matches[0])) { return $matches[0]; } return null; }