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 #180186 is a reply to message #180185] Tue, 22 January 2013 23:51 Go to previous messageGo to previous message
Jrn Andersen is currently offline  Jrn Andersen
Messages: 2
Registered: January 2013
Karma:
Junior Member
On Wed, 23 Jan 2013 00:08:49 +0100, Shake
<alex(dot)estevezQUENO(at)QUENOfilnet(dot)es> wrote:

> Dans son message précédent, Jørn Andersen a écrit :
>>
>> A question from someone relatively new to PHP:
>> Why use constants at all?
>> I always use variables - have I missed something?
>
>
> Because variables have 'Scope':
>
> http://php.net/manual/en/language.variables.scope.php
>

Thanks for explaing.
I do understand the basics about scope, so that makes sense - and I
would probably have used constants a bit more if I had been aware that
constants work across scopes ...

Is there any reason why it is better/worse to use constants instead of
global $var in functions?


Best,
Jørn, Copenhagen

--
Jørn Andersen
http://socialister.dk
http://marxisme.dk
[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 14:46:24 GMT 2024

Total time taken to generate the page: 0.04059 seconds