php - how to get all data from array in a variable? -
i have dynamic array
array ( [company_name] => [address] => b [country_id] => 1 [email] => c@c.com [currency_id] => 1 )
and want create index variable like:
`$var = "company_name,address,country_id,email,currency_id";`
and value variable like:
$value = "a,b,1,c@c.com,1";
remember array index , value not fixed. in advance.
you can try this.
$var = implode(',', array_keys($myarray)); $value = implode(',', array_values($myarray));
where $myarray
array showed in question.
Comments
Post a Comment