I have a variable like so:
$array = array();
$stock = 1500;
How can extract this number and add each number starting from 1 into $array.
For example:
$array = [1, 2, 3, 4, 5, 6, ..., 1500];
All you need is range(). No need for any loops - a simple one-liner is all you need!
$stock = 1500;
$array = range(1, $stock);
range().