3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function numToOrdinalWord($num) { $first_word = array('eth', 'First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelfth', 'Thirteenth', 'Fourteenth', 'Fifteenth', 'Sixteenth', 'Seventeenth', 'Eighteenth', 'Nineteenth', 'Twentieth'); $second_word = array('', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'); if ($num <= 20) return $first_word[$num]; $first_num = substr($num, -1, 1); $second_num = substr($num, -2, 1); return $string = str_replace( 'y-eth', 'ieth', $second_word[$second_num] . '-' . $first_word[$first_num] ); } for(int $i = 0; $i < 100; $i++)echo numToOrdinalWord($i) . PHP_EOL;
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected '$i' (T_VARIABLE), expecting ';' in /in/ludic on line 22
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE, expecting ';' in /in/ludic on line 22
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_VARIABLE, expecting ';' in /in/ludic on line 22
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `';'' in /in/ludic on line 22
Process exited with code 255.