3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test{ function test(){ $arr = array(1,2,3,4,5,6,7); function mySort($a,$b){ return $a-$b; } usort($arr,'mySort'); } } $t = new Test(); $t->test();
Output for 7.0.0 - 7.1.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Test has a deprecated constructor in /in/EHMl6 on line 2 Fatal error: Cannot redeclare mySort() (previously declared in /in/EHMl6:5) in /in/EHMl6 on line 5
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Cannot redeclare mySort() (previously declared in /in/EHMl6:5) in /in/EHMl6 on line 5
Process exited with code 255.
Output for 4.3.2 - 5.2.17
Fatal error: Cannot redeclare mysort() (previously declared in /in/EHMl6:5) in /in/EHMl6 on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot redeclare mysort() (previously declared in /in/EHMl6:5) in /in/EHMl6 on line 5