I stumbled across some code that I wrote a few years ago when I was first learning PHP and didn't know that arrays start at 0 and not 1.
$afc_east[1] = "Buffalo Bills";
$afc_east[2] = "Miami Dolphins";
$afc_east[3] = "New England Patriots";
$afc_east[4] = "New York Jets";
$afc_west[1] = "Denver Broncos";
$afc_west[2] = "Kansas City Chiefs";
$afc_west[3] = "Oakland Raiders";
$afc_west[4] = "San Diego Chargers";
//.... other divisions...
//Put all of the arrays into one
$afc = array($afc_east, $afc_west, $afc_north, $afc_south);
for($i=0;$i<count($afc);$i++)
{
$count = count($afc[$i]);
for($y=1;$y<=$count;$y++)
{
// I'd like to find out how to echo "afc_east" or "afc_west"
$name_of_array = ""; //Idk
echo "$".$name_of_array."[".$y-1."]" = ".$afc[$i][$y].";<br />";
}
}
I want to make all of my arrays start at 0. But, there are simply too many arrays for me to go back and change the numbers in the arrays to one below what they currently are. It would be much easier for me to have php echo out the array names along with their corresponding values and then copy and paste them into the text editor.
1based indexing, as when you eventually do go through and change the arrays to be0indexed, you will have even more work to do.$afc = array('afc_east' => $afc_east, ...