I'm not sure if it is the result it supposed to be, but on page:

http://www.php.net/manual/en/language.oop.constructor.php

The 4th example makes no difference when running under PHP3 and PHP4.
The example is to demostrate constructor:
class A
{
    function A()
    {
        echo "I am the constructor of A.<br>\n";
    }

    function B()
    {
        echo "I am a regular function named B in class A.<br>\n";
        echo "I am not a constructor in A.<br>\n";
    }
}

class B extends A
{
    function C()
    {
        echo "I am a regular function.<br>\n";
    }
}

// This will call B() as a constructor.
$b = new B;And the result is (Under Windows):

D:\TEMP>\php3\php.exe class.php
X-Powered-By: PHP/3.0.17
Content-type: text/html

I am a regular function named B in class A.<br>
I am not a constructor in A.<br>

D:\TEMP>\php4.3\php.exe class.php
Content-type: text/html
X-Powered-By: PHP/4.3.1

I am a regular function named B in class A.<br>
I am not a constructor in A.<br>

D:\TEMP>\php5\php.exe class.php
Content-type: text/html
X-Powered-By: PHP/5.0.0-dev

I am the constructor of A.<br>

Is there something wrong here?  Thanks!



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

Reply via email to