I have an array like below all values are dynamically generated
array(
[education_provider_state]=>Arunanchal Pradesh,Assam
[e_p_coeducational_type]=>Co-Ed,Girls
)
i want output like
array(
[education_provider_state]=>array([0]=>Arunanchal Pradesh[1]=>Assam
[e_p_coeducational_type]=>array([0]=>Co-Ed[1]=>Girls
)
I want to get the values of key and values of corresponding key. How can I achieve this Please somebody help me . Thank You
Simply use array_map
along with the explode
like as
print_R(array_map(function($v){ return explode(',',$v);},$arr));
Output:
Array
(
[education_provider_state] => Array
(
[0] => Arunanchal Pradesh
[1] => Assam
)
[e_p_coeducational_type] => Array
(
[0] => Co-Ed
[1] => Girls
)
)
foreach($array as $key=>$value) {
echo "This is my $key and this is my $value
";
}