On Sun, Jan 3, 2010 at 7:48 AM, <webmas...@vbplusme.com> wrote:

> Hello Eddie,
>
> Sunday, January 3, 2010, 3:25:22 PM, you wrote:
>
> > The primary difference between a variable and a constant is
> > mutability.  If your database authorization details are not going to
> > change, make them constants.  If your database details DO change
> > throughout the execution of a script, make them variables.  In regards
> > to the performance of constants in PHP, that's an incredibly minor
> > improvement (a microoptimization, really) and it's my opinion that you
> > ought to be writing software to be good code and not have to hack
> > around considerations like how many microseconds your database
> > username declaration takes.[...]
>

Though you might also want to consider loading the values from a config
file, which is easy to change when you move your app from place to place,
e.g., from development to production.

Zend_Config makes this especially easy. You set a default configuration
environment and define other flavors that inherit from it.
http://framework.zend.com/manual/en/zend.config.html

-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/
_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation

Reply via email to