Hi Tom,
Welcome to the forum!
There's probably many ways to skin this particular cat ...
<?php
$number_string = '1,5,100-103';
$number_array = array();
foreach(explode(',', $number_string) as $temp){
$check = explode('-', $temp);
$num_check = count($check);
if($num_check == 1){
$number_array[] = $check[0];
} else {
$first = $check[0];
$last = $check[1];
for($i = $first; $i <= $last; $i++){
$number_array[] = $i;
}
}
}
echo '<hr><b>number_array</b>: <pre>'; print_r($number_array); echo '</pre>';
?>
Paul 🙂