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

Home » Imported messages » comp.lang.php » define ('NL', "<br />"); can I define a constant var ?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: define ('NL', "<br />"); can I define a constant var ? [message #180179 is a reply to message #180174] Tue, 22 January 2013 08:39 Go to previous messageGo to previous message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma:
Senior Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Passing complex data back when using cURL
Next Topic: my blog
Goto Forum:
  

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

Current Time: Sat Nov 23 16:51:15 GMT 2024

Total time taken to generate the page: 0.03352 seconds