Re: PHP 4.3.11, question about classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, March 22, 2006 5:27 am, Michael Hulse wrote:
> I am just learning about classes.
>
> My server is running PHP 4.3.11
>
> Example code:
>
> class testing {
> 	var $what;
> }
>
> $linkGenClass = new testing();
> $linkGenClass->what = 'hi';
> echo $linkGenClass->what;
>
> Why does the constructor require the "()"?
>
> I have seen many examples via google that do not use "()".

I dunno.

May be version-dependant, or maybe because you didn't define
__constructor nor function testing() as a contructor...

Try adding a constructor function and see what happens.

> Should I worry about capitalizing the first letter of the class?

Try it and see.

Most crucial is to be consistent.

Second most crucial is to just do it the way everybody else does it.

> Can class names have underscores?

That's in the manual, but try it and see.

> Are spaces allowed on either side of the "->"?

In the manual, try it and see.

> Is "var $what" PHP 4 and 5, whereas "public $what" is PHP 5?

Yes.

> Got any good links to class tutorials for PHP 4.3.11?

info.com/PHP OOP tutorial

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux