title: Best way to determine if string is image, youtube, etc
body: <p>So, I'm looking to code in PHP a function, getType(). This function will take a user inputed string from a web form (in CodeIgniter) and then from there analyze it's content and then determine if the string is a photo (ending in .jpg, .png, etc), a youtube video link, a vimeo video link, or just text.</p>
  
  <p>I'm just having a hard time trying to visualize the best, most economical way to do this.</p>
  
  <pre><code>if (strpos($content, ".jpg|.png|.bmp"))
  { return "image"; }
  else if (strpos($content, "youtube.com"))
  { return "youtube"; }
  else if (strpos($content, "vimeo.com"))
  { return "vimeo" }
  else
  { return "text" }
  </code></pre>