// file extension is allowed to contain 2 to 5 charachers // both upper and lower case and any digit $pattern = "/\\.[a-zA-Z-0-9]{2,5}\$/"; preg_match($pattern, $url, $match); // test the file extension against the allowed arrays // and add code for the appropriate media if (array_search($match[0], $quicktime_extensions) !== FALSE) { quicktime_player($url); } elseif (array_search($match[0], $windowsmedia_extensions) !== FALSE) { windowsmedia_player($url); } elseif (array_search($match[0], $flash_extensions) !== FALSE) { flash_player($url); } elseif (array_search($match[0], $realplayer_extensions) !== FALSE) { real_player($url); } elseif (array_search($match[0], $not_config) !== FALSE) { misc($url); } elseif (array_search($match[0], $weird_extensions) !== FALSE) { weird_player($url); } elseif (array_search($match[0], $flash_flv_extensions) !== FALSE) { flvplayer($url); } elseif (array_search($match[0], $myspace) !== FALSE) { space_player($url); } elseif (array_search($match[0], $embed_code) !== FALSE) { embed_player($embed); } elseif (array_search($match[0], $divx_code) !== FALSE) { divx_player($url); } elseif (array_search($match[0], $googlevideo) !== FALSE) { googleplayer($url); } elseif (array_search($match[0], $streammedia) !== FALSE) { streammedia($url); } elseif (array_search($match[0], $mp3media) !== FALSE) {
function test_list_and_at() { @(list($ok1, $ok2) = misc(1)); echo $ok1; }