PHP VERSION: 8.2.18

remove_php4_constructors.php

<?php
// PHP 4 constructors removed

class Test
{
    protected 
$test 'TEST';
    
// in PHP 5.x this runs as constructor
    
public function test(string $test NULL)
    {
        echo 
$this->test;
    }
}

$a = new Test();

Output


SOURCE CODE