Re: [PHP] simple class constructor

2010-10-19 Thread chris h
Can you paste the index page's code here? If the page is going blank there's probably an error (syntax, bad file path, etc). If you have access you can turn error reporting on so you can actually see the error - or better yet check the php error log file. Settings for both of these are in the

Re: [PHP] simple class constructor

2010-10-19 Thread chris h
Also wanted to point out that you can check the error reporting level and log file location (really all of the php's settings) by calling phpinfo(); in your code. ?php phpinfo(); ? Chris. On Tue, Oct 19, 2010 at 4:54 PM, chris h chris...@gmail.com wrote: Can you paste the index

Re: [PHP] simple class constructor

2010-10-19 Thread Paul M Foster
On Tue, Oct 19, 2010 at 04:12:51PM -0400, David McGlone wrote: Hi everyone, I've been really good at googling to find my answers, but this time my method isn't working for me. I have created a very simple class and a constructor hoping to get a much better understanding of how to work

Re: [PHP] simple class constructor

2010-10-19 Thread David McGlone
On Tue, 2010-10-19 at 17:15 -0400, Paul M Foster wrote: On Tue, Oct 19, 2010 at 04:12:51PM -0400, David McGlone wrote: snip You're trying to instantiate the class. And the way you're doing it here is correct. When you do this, $test becomes an object of this class. If you had another function

RE: [PHP] simple class constructor

2010-10-19 Thread Tommy Pham
-Original Message- From: David McGlone [mailto:da...@dmcentral.net] Sent: Tuesday, October 19, 2010 4:32 PM To: php-general@lists.php.net Subject: Re: [PHP] simple class constructor On Tue, 2010-10-19 at 17:15 -0400, Paul M Foster wrote: On Tue, Oct 19, 2010 at 04:12:51PM -0400

Re: [PHP] simple class constructor

2010-10-19 Thread David Harkness
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

RE: [PHP] simple class constructor

2010-10-19 Thread David McGlone
On Tue, 2010-10-19 at 16:53 -0700, Tommy Pham wrote: -Original Message- From: David McGlone [mailto:da...@dmcentral.net] Sent: Tuesday, October 19, 2010 4:32 PM To: php-general@lists.php.net Subject: Re: [PHP] simple class constructor On Tue, 2010-10-19 at 17:15 -0400, Paul

Re: [PHP] simple class constructor

2010-10-19 Thread David McGlone
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

Re: [PHP] simple class constructor

2010-10-19 Thread David Harkness
The constructor is the __construct() method, and it gets executed automatically when you instantiate the class into an object. The class defines the state (fields/properties) and behavior (methods/functions) that its objects will have. Instantiating the class is the fancy term for creating a new

RE: [PHP] simple class constructor

2010-10-19 Thread Tommy Pham
-Original Message- From: David McGlone [mailto:da...@dmcentral.net] Sent: Tuesday, October 19, 2010 5:32 PM To: php-general@lists.php.net Subject: RE: [PHP] simple class constructor On Tue, 2010-10-19 at 16:53 -0700, Tommy Pham wrote: -Original Message- From: David

Re: [PHP] simple class constructor

2010-10-19 Thread David McGlone
On Tue, 2010-10-19 at 17:41 -0700, David Harkness wrote: The constructor is the __construct() method, and it gets executed automatically when you instantiate the class into an object. The class defines the state (fields/properties) and behavior (methods/functions) that its objects will have.

RE: [PHP] simple class constructor

2010-10-19 Thread Jay Blanchard
[snip] Ye! Ha! Just as I suspected! I can now say I have a very thorough understanding of Classes, Objects and methods. :-) [/snip] May I suggest Head First OOP? They don't do PHP in it but it is very valuable for learning about things like encapsulation and some other cool words. -- PHP General

RE: [PHP] simple class constructor

2010-10-19 Thread David McGlone
On Tue, 2010-10-19 at 20:25 -0500, Jay Blanchard wrote: [snip] Ye! Ha! Just as I suspected! I can now say I have a very thorough understanding of Classes, Objects and methods. :-) [/snip] May I suggest Head First OOP? They don't do PHP in it but it is very valuable for learning about

RE: [PHP] simple class constructor

2010-10-19 Thread David McGlone
On Tue, 2010-10-19 at 20:25 -0500, Jay Blanchard wrote: [snip] Ye! Ha! Just as I suspected! I can now say I have a very thorough understanding of Classes, Objects and methods. :-) [/snip] May I suggest Head First OOP? They don't do PHP in it but it is very valuable for learning about