<?php
class Filter {
// PHP 5: filter is a constructor
// PHP 7: filter is a constructor and E_DEPRECATED is raised
// PHP 8: filter is a normal method and is not a constructor; no E_DEPRECATED is raised
function filter($a) {}
}
$filter = new ReflectionMethod('Filter', 'filter');
// PHP 5: bool(true)
// PHP 7: bool(true)
// PHP 8: bool(false)
var_dump($filter->isConstructor());
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Filter has a deprecated constructor in /in/g1IjY on line 3
bool(true)