Forum Moderators: coopster

Message Too Old, No Replies

switch case statement

         

kkonline

1:52 pm on Mar 9, 2008 (gmt 0)

10+ Year Member



In the below switch case statement i want to check if value of $mime is "image/" and not be very specific to image/jpeg, It can be gif png or anything i am just concerned about "image/" part in the mime

The way it is stored in database is image/jpeg image/gif etc . What should i do?

switch ($mime) {
case "image/jpeg":
echo '<img src="'.$row['link'].'" border="0" height="50" width="50" alt="' . $row['title'] .'" />';

WesleyC

3:12 pm on Mar 9, 2008 (gmt 0)

10+ Year Member



Try this:

if ( strpos( "image/", $mime ) !== false )
{
// Will be executed if the mimetype contains "image/"
...
}