I have a number (e.g. 6) that is dynamically generated and I would like to fill an array with the numbers 1 through the dynamically generated number (in this example, 6):
Use range:
$arr = range(1,6); // Returns an array of elements from start to limit, inclusive.