DEV Community

Discussion on: Pitch me on PHP

Collapse
 
taufik_nurrohman profile image
Taufik Nurrohman • Edited

You can have class, constant, function, method and property with the same name.

$foo = new foo(); // class `foo`
echo foo; // constant `foo`
foo(); // function `foo`
$foo->bar(); // method `bar`
$foo->bar; // property `bar`
Enter fullscreen mode Exit fullscreen mode