3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $limit = 50; for($i = 1; $i <= $limit; $i++){ $f = "<?php echo \"P$i loaded\\n\"; class P$i{ public static function execute_me(){ return \"P$i executed\\n\"; } }"; file_put_contents("/tmp/P$i.class.php", $f); } function __autoload($class_name) { require_once '/tmp/' . $class_name . '.class.php'; } function callback($limit, $i = 1){ //class_exists("P$i"); echo call_user_func_array(array("P$i", 'execute_me'), array()); if($i < $limit) callback($limit, $i+1); } callback($limit);
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
P1 loaded P1 executed P2 loaded P2 executed P3 loaded P3 executed P4 loaded P4 executed P5 loaded P5 executed P6 loaded P6 executed P7 loaded P7 executed P8 loaded P8 executed P9 loaded P9 executed P10 loaded P10 executed P11 loaded P11 executed P12 loaded P12 executed P13 loaded P13 executed P14 loaded P14 executed P15 loaded P15 executed P16 loaded P16 executed P17 loaded P17 executed P18 loaded P18 executed P19 loaded P19 executed P20 loaded P20 executed P21 loaded P21 executed P22 loaded P22 executed P23 loaded P23 executed P24 loaded P24 executed P25 loaded P25 executed P26 loaded P26 executed P27 loaded P27 executed P28 loaded P28 executed P29 loaded P29 executed P30 loaded P30 executed P31 loaded P31 executed P32 loaded P32 executed P33 loaded P33 executed P34 loaded P34 executed P35 loaded P35 executed P36 loaded P36 executed P37 loaded P37 executed P38 loaded P38 executed P39 loaded P39 executed P40 loaded P40 executed P41 loaded P41 executed P42 loaded P42 executed P43 loaded P43 executed P44 loaded P44 executed P45 loaded P45 executed P46 loaded P46 executed P47 loaded P47 executed P48 loaded P48 executed P49 loaded P49 executed P50 loaded P50 executed