Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6180

Re: forcing double quotes

From Scott Johnson <noonehome@chalupasworld.com>
Newsgroups comp.lang.php
Subject Re: forcing double quotes
Date 2012-05-25 04:54 -0700
Organization A noiseless patient Spider
Message-ID <jpnrup$45k$1@dont-email.me> (permalink)
References <16h7yuzz2ij5y.1kuobop2m04gl.dlg@40tude.net>

Show all headers | View raw


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.string.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;

?>

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

forcing double quotes richard <member@newsguy.com> - 2012-05-25 01:30 -0400
  Re: forcing double quotes "Olaf S." <thesys@gmx.de> - 2012-05-25 08:26 +0200
    Re: forcing double quotes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-25 15:22 +0200
      Re: forcing double quotes "Olaf S." <thesys@gmx.de> - 2012-05-25 21:57 +0200
        Re: forcing double quotes "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2012-05-25 20:35 +0000
          Re: forcing double quotes Scott Johnson <noonehome@chalupasworld.com> - 2012-05-26 07:09 -0700
  Re: forcing double quotes Shake <QUITAESTO@QUITAESTO.NOES> - 2012-05-25 09:54 +0200
  Re: forcing double quotes The Natural Philosopher <tnp@invalid.invalid> - 2012-05-25 09:46 +0100
  Re: forcing double quotes Scott Johnson <noonehome@chalupasworld.com> - 2012-05-25 04:54 -0700
  Re: forcing double quotes Markus Sonnenberg <lassmichinruhe@rz-amper.de> - 2012-05-25 15:57 +0200
  Re: forcing double quotes Michael Fesser <netizen@gmx.de> - 2012-05-25 21:19 +0200

csiph-web