tarun Posted December 6, 2006 Share Posted December 6, 2006 Hi GuysI want to make a thing which when the variable $file is a gif filetype it echos <img src="$file"> and when it is a mp3 <embed src="$file">(or wateva the embeded tag is 4 mp3)thnx ppli really appreciate it Link to comment https://forums.phpfreaks.com/topic/29694-arrgghh-help-me/ Share on other sites More sharing options...
c4onastick Posted December 7, 2006 Share Posted December 7, 2006 [code]if (preg_match( "/[.]gif$/i", $file )){ echo "<img src='".$file."'>";}elseif (preg_match( "/[.]mp3$/i", $file )){ echo "<embed src='".$file."'>";}[/code]Just as kind of an aside too, make sure you post something descriptive in the title of the thread. "Arrgghh HELP ME" isn't very descriptive, the moderators here do lock threads often that have titles like that. "Matching file extensions" would be better. Cheers!http://regexlib.com/CheatSheet.aspxhttp://regexlib.com/RETester.aspx Link to comment https://forums.phpfreaks.com/topic/29694-arrgghh-help-me/#findComment-136723 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.