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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -