I have two arrays, one that contains all options, and a second one that contains the default values.
The options arrays looks like this:
$options = array(
"SeriesA" => array(
"A1" => array(
"text" => "A1",
"value" => "A-001"
),
"A2" => array(
"text" => "A2",
"value" => "A-002"
)
),
"SeriesB" => array(
"B1" => array(
"text" => "B2",
"value" => "B-001"
),
"B2" => array(
"text" => "B2",
"value" => "B-002"
)
),
);
And I have another array that contains default value, and it looks like this
$defaults= array(
"SeriesA" => "A-002",
"SeriesB" => "B-001",
);
What I would like to end up with is one array that contains all info, is there a way that I can map both arrays and get one array that will look like this:
$options = array(
"SeriesA" => array(
"A1" => array(
"text" => "A1",
"value" => "A-001",
"default" => false
),
"A2" => array(
"text" => "A2",
"value" => "A-002",
"default" => true
)
),
"SeriesB" => array(
"B1" => array(
"text" => "B2",
"value" => "B-001",
"default" => true
),
"B2" => array(
"text" => "B2",
"value" => "B-002",
"default" => false
)
),
);