PHP 5 Oddities

windows

Guest
Here are a few strange things I have noticed while using PHP 5. Feel free to add to this so we can give a nice Christmas present to Zend ;)

function __autoload()
{
throw new Exception("This is foobar");
}

class a
{
function __construct()
{
echo "This constructor gets thrown in lieu of a child constructor. Not a bad thing : )";
}
}
class b extends a {}
$b = new b;

Note these are as of PHP version 5.0.2 / Win.Is that so odd? You didn't specify a constructor so it uses the parents constructor? Isn't that what's supposed to happen?

If you specify a constructor in the child it overrules the parent's otherwise it uses the parents constructor?Oh my bad, I thought with PHP 4 you needed to explicitly call the parent constructor, but apparently not.
 
Back
Top