
November 4th, 2012, 06:53 AM
|
|
Registered User
|
|
Join Date: May 2012
Posts: 2
Time spent in forums: 50 m 10 sec
Reputation Power: 0
|
|
General - Dynamically create array name holder
Hi, is it possible to dynamically create an array name holder
I have the following:
Code:
while ($row = mysql_fetch_array($results_select_events)) {
if ($build_month_events_array_counter == 0){
$month1_array[] = $row;
}
if ($build_month_events_array_counter == 1){
$month2_array[] = $row;
}
if ($build_month_events_array_counter == 2){
$month3_array[] = $row;
}
if ($build_month_events_array_counter == 3){
$month4_array[] = $row;
}
if ($build_month_events_array_counter == 4){
$month5_array[] = $row;
}
if ($build_month_events_array_counter == 5){
$month6_array[] = $row;
} etc etc etc
but was wondering if it's possible to do something like:
Code:
$month.$build_month_events_array_counter_array[] = $row;
This would reduce the code by creating the array name incremented by the counter!
I have tried but cannot get working - please any help appreciated
|