ID:          37258
 Updated by:  [EMAIL PROTECTED]
 Reported By: php-bugs at T43 dot mine dot nu
-Status:      Open
+Status:      Feedback
 Bug Type:    Documentation problem
 PHP Version: Irrelevant
 New Comment:

1) "How to define a member, How to define a method" 
This is explained in this example:

http://php.net/language.oop5.basic#AEN5708

2) "How to add a member to the class on the fly" 
I fail to see what you're trying to describe here.

3) "Constructors: the classname($var) syntax"
This is already documented:

"For backwards compatibility, if PHP 5 cannot find a __construct()
function for a given class, it will search for the old-style
constructor function, by the name of the class."

4) "There can only be one constructor, as opposed to C++."

Who said PHP was like C++? This is how PHP works, you can't define two
functions with the same name having different parameters.

5) "Further, when there is a constructor, the new operator has to use
it."

This is how functions/methods generally work, if an argument is not
optional, you've to specify its value, nothing new/undocumented.

Until you've something new, this bug report seems bogus to me.


Previous Comments:
------------------------------------------------------------------------

[2006-05-01 13:45:56] php-bugs at T43 dot mine dot nu

The scope of members, defined on the fly (not in the class definition),
is not specified. 

given $this->newmember='sweet', is newmember public?
given $apple->newmember='sour', is newmember public?

------------------------------------------------------------------------

[2006-05-01 13:40:38] php-bugs at T43 dot mine dot nu

The oop5 documentation does not point to the class handling functions
(as the oop4 documentation did, on the very first, the 'class' page at
the end.)

------------------------------------------------------------------------

[2006-05-01 13:29:34] php-bugs at T43 dot mine dot nu

more missing. There can only be one constructor, as opposed to C++. So
function classname($var1,$var2) can't coexist with
function classname($var1) .

Further, when there is a constructor, the new operator has to use it.
Given function classname($var1),
the call
$apple= new classname; fails, but
$apple=new classname('apple') is required syntax.

------------------------------------------------------------------------

[2006-05-01 13:17:11] php-bugs at T43 dot mine dot nu

Description:
------------
the oop5 documentation has a lot of unclear / missing very basic
passages. Among them are:

Basics: How to define a member, How to define a method
How to add a member to an instance ($apple->newmember)
How to add a member to the class on the fly
Constructors: the classname($var) syntax

The sentence "Followed by a pair of curly braces, OF which contains the
definition " the word 'OF' is grammatically wrong in the ears of
non-english, making the sentence non-understandable.

Most of this was missing in the php4 class documentation too. It is not
clear whether the php5 class chapter replaces, or augments the php4
class chapter.

I can't fix it as I can't delve into the sources of ZEND engine and the
like.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37258&edit=1

Reply via email to