Object Oriented Programming question

Brent Baisley brent at
Tue Jun 18 15:28:13 EDT 2002

Most of my experience has been in scripting and procedural programming and I
am now trying to get my brain around class files and such. I have a question
about whether I'm heading down the right road or not. I've tried looking
into PEAR, but I think it's a bit too much for me right now, I need more
foundation to really understand what's going on.

I've setup a "settings" file that I would like to contain "default" values
like the mysql login name, password and database. One of the functions in my
class file is a db connection function. I've set it up to accept the login
name, password and database as parameters that can be passed.

What I would like to do is use default values set in the settings file if
parameters aren't passed. I tried using the syntax for setting a default
value for a parameter if a value isn't passed, but I guess you can't use
variables in this since I get errors. I want to only pass values to the
function if I don't want to use the default values.

Would like something like this:
function db_connect($db_user = $dflt_user, $db_pswd = $dflt_pswd, $db_dbname
= $dflt_dbname);

Any enlightenment would be appreciated.
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

More information about the talk mailing list