Re: simple class & constructor
| From: | David McGlone | Date: | Wed, 20 Oct 2010 00:39:00 +0000 |
| Subject: | Re: simple class & constructor | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308866@lists.php.net to get a copy of this message | ||
On Tue, 2010-10-19 at 17:05 -0700, David Harkness wrote:
> Note that you still have a typo, but maybe it's only in your email messages:
>
> class simpleConstructer {
>
> function __construct() {
> echo "running the constructor";
> }
> }
> $test = new simpleConstructor();
>
> The class is misspelled; it should be simpleConstructor. As a side note,
> it's common convention to name classes with a leading capital letter, e.g.
> SimpleConstructor. That's just convention, though, and I'm sure it differs
> in some languages. Even in PHP stdClass doesn't, but most other classes do.
Thank you David, the typo was in my code. :-/
As for the class names, I agree with you. I've read so many books where
things are changed up that I can't remember which way to do it. In this
case since I was playing around for learning purposes, I just guessed
and run with it.
I appreciate the heads up :-)
--
Blessings
David M.