Take a look at the range function.
$array = range(1, $num);
More Related Contents:
- php , I want to build array from 12 values each value has max number of 2048
- “Notice: Undefined variable”, “Notice: Undefined index”, “Warning: Undefined array key”, and “Notice: Undefined offset” using PHP
- How to add elements to an empty array in PHP?
- PHP Multiple Checkbox Array
- How create an array from the output of an array printed with print_r?
- Test if number is odd or even
- Create new variables from array keys in PHP
- Convert a String to Variable
- How to cast variable to array
- Access an Array Returned by a Function [duplicate]
- PHP multidimensional array search by value
- How to sum all column values in multi-dimensional array?
- php – insert a variable in an echo string
- Build a tree from a flat array in PHP
- Get difference between associative rows of two 2-dimensional arrays
- Sort an array by a child array’s value in PHP
- Is there a way to fetch associative array grouped by the values of a specified column with PDO?
- php – get numeric index of associative array
- How to check an IP address is within a range of two IPs in PHP?
- How to find array / dictionary value using key?
- PHP object like array
- Flip associative array and store new values in subarrays to prevent losing duplicated values
- Merge two indexed arrays of indexed arrays based on first column value
- What causes: “Notice: Uninitialized string offset” to appear? [closed]
- Get most recent date from an array of dates in “Y-m-d H:i:s” format
- Move an array element to a new index in PHP
- PHP get all arguments as array?
- Convert PHP array string into an array
- Jquery load() and PHP variables
- Get count of each unique value in one column of a 2d array