FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » forcing double quotes
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: forcing double quotes [message #178260 is a reply to message #178256] Fri, 25 May 2012 11:54 Go to previous messageGo to previous message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma:
Senior Member
On 5/24/2012 10:30 PM, richard wrote:
>
> echo "<a href='#'>"
>
> how do you make it so that the output will show "#"?
> &quot; in place of the ' does not work.

If you are working with many tags that you have to have in double quotes
and don't want to have many escapes I find this works very well for me.

Heredocs

http://www.php.net/manual/en/language.types.string.php#language.types.strin g.syntax.heredoc

<?php
// off the cuff
define("SITE_NAME", "SiteName");
$id = 1;
$alt_color = "yellow";
$content = "http://" . SITE_NAME;

$link = <<<EOD // Must be on its own line but not needed to be first.
<table border="0" cellpadding="0" cellsapcing="0">
<tr class="tr_class">
<td style="border-bottom:1px solid gray; color:{$alt_color};">
<a href="http://{$content}?id={$id}">{$content}</a>
</td>
</tr>
</table>
EOD; // Must be first and only on its own line.

echo $link;

?>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: multiple image upload and thumbnail display
Next Topic: Overriding PHP INI Setting session.use_trans_sid=0
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Jul 03 09:20:28 GMT 2024

Total time taken to generate the page: 0.05064 seconds