You'll probably not like the results of incorporating the
contents of the gif or jpeg into your current php file
as if they were html source. Are you perhaps trying to
determine the appropriate source file for an <img>?
If so, you can do it this way:
if (file_exists("img/web_01.gif"))
echo "<img src=\"img/web_01.gif\">";
elseif (file_exists("img/web_01.jpg"))
echo "<img src=\"img/web_01.jpg\">";
// else neither file exists, so don't show any image at all