Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #6183
| Message-ID | <4334594.ikGlJlNZSe@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2012-05-25 15:22 +0200 |
| Subject | Re: forcing double quotes |
| Newsgroups | comp.lang.php |
| Followup-To | comp.lang.php |
| References | <16h7yuzz2ij5y.1kuobop2m04gl.dlg@40tude.net> <4fbf262f$0$9515$9b4e6d93@newsspool1.arcor-online.net> |
Followups directed to: comp.lang.php
[Cancel & Supersedes: Sorry, copy-and-paste error resulting in invalid code]
Olaf S. wrote:
> Am 25.05.2012 07:30, schrieb richard:
>> echo "<a href='#'>"
>>
>> how do you make it so that the output will show "#"?
>> " in place of the ' does not work.
>
> echo '<a href="#">#</a>';
PHP is the *P*HP *H*ypertext *P*reprocessor. Use it:
<?php
…
?><a href="#">#</a><?php
…
?>
(Insert line-breaks where convenient, but be aware that they result in
whitespace text nodes which in turn may result in a space character being
displayed. Consult the HTML 4.01 Specification for details.)
This approach (stdin – parse – stdout) wins over a here-doc string in almost
all cases, as by contrast the ending delimiter of a here-doc string must be
at the first column (so is not easy to indent), can only be followed by at
least a semicolon (which means concatenation for more complex expressions),
and requires escaping of some characters that do not have to be escaped with
the approach above.
Incidentally, it is described and recommended by one of the first chapters
of the PHP manual:
<http://php.net/manual/en/tutorial.firstpage.php>
It should also be noted that PHP 5.4 does away with the nonsense that
`<?= … ?>' would not be working with short_open_tag=Off (which required you
to write `<?php echo …; ?>' instead), so there is no good excuse left to
`echo' *everything* (instead of just the dynamic parts) rather ineffiently:
<http://php.net/ChangeLog-5.php>
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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