Re: define() or $variable for application settings?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris wrote:
Hi Matt,

I use define's.

me too. mostly because unless you use the runkit extension or
something you can't undefine or change the values of a constant.

bare in mind though that define() is horribly slow (to paraphrase
Rasmus) which may be the reason many projects choose to use variables
instead. see here:

http://php.net/manual/en/function.apc-define-constants.php


With variables it's easy to forget to global'ise it when you go into a function, define's don't have this issue.

also true :-).


Matt Arnilo S. Baluyos (Mailing Lists) wrote:

Hello Everyone,

I have a config.inc.php file which basically contains all the
configuration info that the applications needs (directory/file
locations, database credentials, etc). The information there is set
using the define() function.

However, I've seen some open-source projects which either use
$variables or associative arrays to save the values.

My application works pretty fine but I'd like to solicit opinions from
everyone on what they are using in this case. Also, I have plans of
putting up a sort of coding guidelines for the company so it might
help to have other opinions on this one.

Thanks and best regards,
Matt



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux