Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #8113
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Arno Welzel <usenet@arnowelzel.de> |
| Newsgroups | comp.lang.php |
| Subject | Re: define ('NL', "<br />"); can I define a constant var ? |
| Date | Tue, 22 Jan 2013 09:39:07 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 32 |
| Message-ID | <50FE502B.2070708@arnowelzel.de> (permalink) |
| References | <bfe0fbed-6727-437f-9c62-552c03dd4692@b11g2000yqh.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | mx04.eternal-september.org; posting-host="94cd017c1d3a4901a0e26b8247203f86"; logging-data="23360"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uJr5s9ph4YIVJqU4jaLKO5YIUhDmuLAA=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
| In-Reply-To | <bfe0fbed-6727-437f-9c62-552c03dd4692@b11g2000yqh.googlegroups.com> |
| Cancel-Lock | sha1:/QuYDyrzEbGUz9cCWvje13VRy/w= |
| Xref | csiph.com comp.lang.php:8113 |
Show key headers only | View raw
cate, 2013-01-22 01:06:
> I can see why this doesn't work:
>
> define ('NL', '<br />');
> echo "This is NL another line";
>
> Is there a way to define a constant variable in PHP?
Maybe you want to look at the documentation:
<http://php.net/manual/en/language.constants.php>
So - yes the define is OK.
But your echo will not work, since NL is not automatically treated as a
placeholder. You have to write:
echo "This is ".NL." another line";
With variables this would be easier though:
$NL = '<br />';
echo "This is $NL another line";
hth
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
define ('NL', "<br />"); can I define a constant var ? cate <catebekensail@yahoo.com> - 2013-01-21 16:06 -0800
Re: define ('NL', "<br />"); can I define a constant var ? Adam Harvey <usenet@adamharvey.name> - 2013-01-22 00:44 +0000
Re: define ('NL', "<br />"); can I define a constant var ? BobMCT <r.mariotti@fdcx.net> - 2013-01-21 21:16 -0500
Re: define ('NL', "<br />"); can I define a constant var ? Kim André Akerø <kimandre@nospambetadome.com> - 2013-01-22 03:50 +0100
Re: define ('NL', "<br />"); can I define a constant var ? denisb <newdb@no-log.org> - 2013-01-22 08:17 +0100
Re: define ('NL', "<br />"); can I define a constant var ? Arno Welzel <usenet@arnowelzel.de> - 2013-01-22 09:39 +0100
Re: define ('NL', "<br />"); can I define a constant var ? Luuk <luuk@invalid.lan> - 2013-01-22 19:43 +0100
Re: define ('NL', "<br />"); can I define a constant var ? Tim Streater <timstreater@greenbee.net> - 2013-01-22 18:58 +0000
Re: define ('NL', "<br />"); can I define a constant var ? Luuk <luuk@invalid.lan> - 2013-01-22 20:08 +0100
Re: define ('NL', "<br />"); can I define a constant var ? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-01-23 01:35 +0100
Re: define ('NL', "<br />"); can I define a constant var ? Arno Welzel <usenet@arnowelzel.de> - 2013-01-23 10:59 +0100
Re: define ('NL', "<br />"); can I define a constant var ? The Natural Philosopher <tnp@invalid.invalid> - 2013-01-22 19:40 +0000
Re: define ('NL', "<br />"); can I define a constant var ? Arno Welzel <usenet@arnowelzel.de> - 2013-01-23 10:55 +0100
Re: define ('NL', "<br />"); can I define a constant var ? Jørn Andersen <jorn@jorna.dk> - 2013-01-22 23:51 +0100
Re: define ('NL', "<br />"); can I define a constant var ? Shake <alex.estevezQUENO@QUENOfilnet.es> - 2013-01-23 00:08 +0100
Re: define ('NL', "<br />"); can I define a constant var ? Jørn Andersen <jorn@jorna.dk> - 2013-01-23 00:51 +0100
Re: define ('NL', "<br />"); can I define a constant var ? "Peter H. Coffin" <hellsop@ninehells.com> - 2013-01-22 19:03 -0600
Re: define ('NL', "<br />"); can I define a constant var ? Shake <alex.estevezQUENO@QUENOfilnet.es> - 2013-01-23 03:42 +0100
Re: define ('NL', "<br />"); can I define a constant var ? Jerry Stuckle <jstucklex@attglobal.net> - 2013-01-22 19:50 -0500
csiph-web