echo "<select>"; $range = range(120,130); foreach ($range as $cm) { echo "<option value='$cm'>$cm cm</option>"; } echo "</select>";
The range() function can handle all the situations described in the comment.
range(30.5, 50.5, 0.5); // 30.5, 31, 31.5, 32, etc range(30, 50, 2); // 30, 32, 34, 36, 38, 40 etc
gnarf source share