And, on rereading your question.. I discovered I'd answered a tangential question, but not the PHP image function.
That too is a "Yes", and for the same reason I'd discussed above.
The <img> tag is executed by the browser, which doesn't care if it's a 'real' image or an image returned by a PHP script.
I use this to AJAX enable the thermometer.php on my site <td align="center" valign="top"><span class="ajax" id="ajaxthermometer"><?php
$tstr = "Currently $temperature, Max: $maxtemp, Min: $mintemp";
?><img src="thermometer.php?uom=F" alt="<?php echo $tstr; ?>"
title="<?php echo $tstr; ?>" height="170" width="54" /></span> </td>
which results in the browser seeing <td align="center" valign="top"><span class="ajax" id="ajaxthermometer"><img src="thermometer.php?uom=F" alt="Currently 58.7°F, Max: 66.6°F, Min: 44.2°F"
title="Currently 58.7°F, Max: 66.6°F, Min: 44.2°F" height="170" width="54" /></span> </td>
which looks like this as generated source (after AJAX JavaScript executes): <td align="center" valign="top"><span style=""
lastobs="<img src="./thermometer.php?t=58.6" width="54" height="170" alt="Currently 58.6, Max: 66.6, Min: 44.2" title="Currently 58.6, Max: 66.6, Min: 44.2" />"
class="ajax" id="ajaxthermometer"><img src="./thermometer.php?t=58.6" alt="Currently 58.6, Max: 66.6, Min: 44.2" title="Currently 58.6, Max: 66.6, Min: 44.2" height="170" width="54"></span> </td>
Best regards,
Ken