php interface

Today i was writing following code:

interface iTest
{
    function testMe($x);
}

class Test implements iTest
{
    public function testMe($x, $y="World")
    {
        print $x . $y;
    }
}

$test = new Test();
$test->testMe("Hello ");

The declaration of the method in class differs from interface, so I was surprised at this situation. Why php doesn’t generate any errors?! :)

This entry was posted on Wednesday, March 21st, 2007 at 11:26 PM and is filed under php. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.