If I have multiple numerical ranges I need to put into an array (i.e. 1-14 and 21-30), how would I do this?
PHP has range(), but it only handles one range: http://php.net/manual/en/function.range.php
If I have multiple numerical ranges I need to put into an array (i.e. 1-14 and 21-30), how would I do this?
PHP has range(), but it only handles one range: http://php.net/manual/en/function.range.php
$alphas = array_merge(range('A', 'Z'), range('a', 'z'));
Try with below code:
<?php
$number = range(0,14);
$num= range(21,30);
$array = array_merge($number , $num );
print_r ($array );
?>
Here is Demo
For your reference Reference Link
range()onearray_merge()