Hello How can i onvert this simple html line to a php line: <div style="text-align:center"><a href="http://www.site.com"><img src="blah.png" alt="" height="100" width="100" /></a></div> HTML: Thank you
What do you mean by convert it? If you want the same thing just in PHP I guess just do this: <?php echo "<div style=\"text-align:center\"><a href=\"http://www.site.com\"><img src=\"blah.png\" alt=\"\" height=\"100\" width=\"100\" /></a></div>";?> PHP: If that's not what you wanted you need to give more details on what you actually need, VERY general.
It's much better to use single quotes for literal strings; you don't have to escape every double quote and it executes slightly faster. <?php echo '<div style="text-align:center"><a href="http://www.site.com"><img src="blah.png" alt="" height="100" width="100" /></a></div>'; ?> PHP:
or you can use HEREDOC (i think i got the name right!): <?php echo <<<HTML <div style="text-align:center"><a href="http://www.site.com"><img src="blah.png" alt="" height="100" width="100" /></a></div> HTML; ?> PHP: and you don't even have to worry about use of single/double quotes. you can even echo php, i.e. variables et al, directly within it .