3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Defining __construct and filter makes filter a normal method class Filter { // PHP 4/5: E_STRICT "Redefining already defined constructor" // PHP 7: No error is raised // PHP 8: No error is raised function filter($a) { echo "In Filter::filter method\n"; } // This raises the E_STRICT in PHP 4/5 function __construct() { echo "In Filter constructor\n"; } } $f = new Filter(); $f->filter(3);
Output for 7.0.0 - 7.2.0
In Filter constructor In Filter::filter method
Output for 5.3.18 - 5.6.28
Strict Standards: Redefining already defined constructor for class Filter in /in/Rp9r5 on line 12 In Filter constructor In Filter::filter method