how to add alt attribute in img tag in php so that it displays text

are you talking about echoing HTML from php? if so then exactly the same way as HTML,

<?php

echo "
<img src="path/pic.jpg" alt="image" />
"

?>
 
Back
Top