Skip to content

Instantly share code, notes, and snippets.

@heavenshell
Created August 24, 2010 17:01
Show Gist options
  • Save heavenshell/547894 to your computer and use it in GitHub Desktop.
Save heavenshell/547894 to your computer and use it in GitHub Desktop.
<?php
class Foo
{
public function Foo()
{
var_dump(__METHOD__);
}
public function __construct()
{
var_dump(__METHOD__);
}
}
error_reporting(E_ALL|E_STRICT);
$foo = new Foo();
//Strict standards: Redefining already defined constructor for class Foo in /tmp/foo.php on line 9
//string(16) "Foo::__construct"
<?php
class Foo
{
public function __construct()
{
var_dump(__METHOD__);
}
public function Foo()
{
var_dump(__METHOD__);
}
}
error_reporting(E_ALL|E_STRICT);
$foo = new Foo();
//string(16) "Foo::__construct"
<?php
namespace Foo;
class Foo
{
public function Foo()
{
var_dump(__METHOD__);
}
public function __construct()
{
var_dump(__METHOD__);
}
}
error_reporting(E_ALL|E_STRICT);
$foo = new Foo();
//string(20) "Foo\Foo::__construct"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment