This is an example of my original code which seems to work:
$MainArray = array('Part1'=>array(Foo, 4, 2, Cat), 'Part2'=>array(Bar, 3, 1, Dog));
print_r ($MainArray);
Returns:
Array ( [Part1] => Array ( [0] => Foo [1] => 4 [2] => 2 [3] => Cat ) [Part2] => Array ( [0] => Bar [1] => 3 [2] => 1 [3] => Dog ) )
What I would like to do is something like this (the pieces are included based on if statements):
$ArrayPieces.="'Part1'=>array(Foo, 4, 2, Cat), ";
$ArrayPieces.="'Part2'=>array(Bar, 3, 1, Dog)";
$MainArray = array($ArrayPieces);
print_r ($MainArray);
But this returns:
Array ( [0] => 'Part1'=>array(Foo, 4, 2, Cat), 'Part2'=>array(Bar, 3, 1, Dog))
Any suggestions on how to make this work? Thanks!