3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $target_dir = "in/"; $uploaded_file = 'asurite_hw1.m'; // Splits the input file name and its extension. $base_name = pathinfo($uploaded_file, PATHINFO_FILENAME); $extension = pathinfo($uploaded_file, PATHINFO_EXTENSION); // Searches through other submissions from the student // and returns the next highest attempt ct. $previous_files = glob($target_dir . $base_name . '*'); $previous_files = array('asurite_hw1_1.m'); $attempt = 1; foreach ($previous_files as $f) { $r = preg_match('/.+_(\d+)\.m/', $f, $matches); if (count($matches) > 1 && $attempt <= $matches[1]) { $attempt = $attempt + 1; } } print_r($id); $ ?>
based on 8eNsL
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '?>', expecting variable (T_VARIABLE) or '{' or '$' in /in/g25f0 on line 26
Process exited with code 255.
Output for 5.4.11 - 5.6.17
Parse error: syntax error, unexpected '?>', expecting variable (T_VARIABLE) or '$' in /in/g25f0 on line 26
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected ';', expecting T_VARIABLE or '$' in /in/g25f0 on line 26
Process exited with code 255.