Frankly, you are grossly over-complicating this by naming your arrays separately and then trying to use variable variables. Using an array of arrays would be so much simpler, e.g.,
<?php
$months = array_fill(0, 12, array('1234', '567890'));
echo '<pre>';
print_r($months);
echo '</pre>';
rhorne wrote:if I want to insert specific values into one of the sub array, say month_5, how do I specifically target that?
With an array of arrays, this becomes trivial, e.g.,
$months[4][] = 'whatever';
You can of course use array_push if you prefer.
EDIT:
rhorne wrote:It seemed a strange one because there was nothing particularly complex or revolutionary going on there, but combining variable variables with array_push just didn't seem to want to work.
You just used incorrect syntax for the semantics that you were looking for. If you absolutely must use variable variables, then your loop should have been:
for ($x = 1; $x <= 12; $x++)
{
array_push(${'month_' . $x}, "1234", "567890");
}
But frankly, an array of arrays is simply better.