I have the following array
array (
[customer_name] =>{customer1,customer2}
[phone] => {123456,123456}
[email] => {[email protected],[email protected]}
[project] => {"Project A","Project B"}
[property] => {A1,A2}
[amount] => {100.00,2000.00}
)
I want to split the array based on keys and assign to different variables. For example
$customer_name=array(customer1,customer2)
$phone=array(123456,123456)
// and so on
Please help. Thanks in advance.
You could use foreach to do that and reassign variables inside the loop:
foreach($array as $key => $values) {
$values = str_replace(array('{', '}'), '', $values);
${$key} = explode(',', $values);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments