3v4l.org

run code in 300+ PHP versions simultaneously
<?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); $ ?>
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.5.24 - 5.5.31, 5.6.8 - 5.6.17
Parse error: syntax error, unexpected '?>', expecting variable (T_VARIABLE) or '$' in /in/g25f0 on line 26
Process exited with code 255.

preferences:
166.74 ms | 1395 KiB | 28 Q