Re: first php 5 class
| From: | Eric Butera | Date: | Wed, 30 Jan 2008 13:40:18 +0000 |
| Subject: | Re: first php 5 class | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268322@lists.php.net to get a copy of this message | ||
On Jan 29, 2008 3:29 PM, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> On Jan 29, 2008 3:19 PM, nihilism machine <nihilismmachine@gmail.com> wrote:
>
> > Ok, trying to write my first php5 class. This is my first project
> > using all OOP PHP5.2.5.
> >
> > I want to create a config class, which is extended by a connection
> > class, which is extended by a database class. Here is my config class,
> > how am I looking?
> >
> > <?php
> >
> > class dbconfig {
> > public $connInfo = array();
> > public $connInfo[$hostname] = 'internal-db.s23499.gridserver.com';
> > public $connInfo[$username] = 'db23499';
> > public $connInfo[$password] = 'ryvx4398';
> > public $connInfo[$database] = 'db23499_donors';
> >
> > public __construct() {
> > return $this->$connInfo;
> > }
> > }
> >
> > ?> <http://www.php.net/unsub.php>
>
>
> if youre going to have a class for configuration information; you probly
> should
> go for singleton:
>
> http://www.phppatterns.com/docs/design/singleton_pattern?s=singleton
>
> -nathan
>
Still pimping singleton, huh? :)