<p>Is there any advantage to using <code>__construct()</code> instead of the class's name for a constructor in PHP?</p>

<p>Example (<code>__construct</code>):</p>

<pre><code>class Foo {
    function __construct(){
        //do stuff
    }
}
</code></pre>

<p>Example (named):</p>

<pre><code>class Foo {
    function Foo(){
        //do stuff
    }
}
</code></pre>

<p>Having the <code>__construct</code> method (first example) is possible since PHP 5.</p>

<p>Having a method with the same name as the class as constructor (second example) is possible from PHP version 4 until version 7.</p>

```
__construct
```
was introduced in PHP5. It is the way you are supposed to do it now. I am not aware of any
advantages
per se, though.
From the PHP manual:
For backwards compatibility, if PHP 5 cannot find a __construct() function for a given class, it will search for the old-style constructor function, by the name of the class. Effectively, it means that the only case that would have compatibility issues is if the class had a method named __construct() which was used for different semantics
If you're on PHP5 I would recommend using
```
__construct
```
to avoid making PHP look elsewhere.