3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function gradeInList($level_id) { $grade_range = 'k-1'; $grade_range_arr = explode('-', $grade_range); if ($grade_range_arr['0'] == 'K') { $grade_range_arr['0'] = 0; } if (stripos($grade_range,'N/A') !== false) { return array('N/A'); } $list = array(); foreach (range($grade_range_arr['0'], $grade_range_arr['1']) as $grade) { if ($grade == 0) { $list[] = 'K'; continue; } if ($grade == 1) { $list[] = '1st'; continue; } if ($grade == 2) { $list[] = '2nd'; continue; } if ($grade == 3) { $list[] = '3rd'; continue; } $list[] = $grade . 'th'; } return $list; } print_r(gradeInList(null));
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => K [1] => 1st )
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: stripos() in /in/HdGgN on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: stripos() in /in/HdGgN on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: stripos() in /in/HdGgN on line 9