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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.