0

i'm trying to implode an array using:

  $implode_keys = implode(',', array_values($arr)
   $implode_values = implode(',', array_keys($arr)
  • What does `var_dump($arr)` print? – Ry- Dec 16 '12 at 03:05
  • 1
    See http://stackoverflow.com/questions/1319903/how-to-flatten-a-multidimensional-array on flattening the array. How do you intend to insert it? It is generally never a good idea to store a multi-part item like an array in a database column. – Michael Berkowski Dec 16 '12 at 03:05

2 Answers2

1

serialize the array (or array of arrays). That's what serialization is intended for. When you need it back as an array (or array of arrays)... just unserialize it.

For future generations... serialization flattens out a data structure, such as an array, so that it may be stored in a simplified fashion, such as in a database.

Ian Atkin
  • 6,302
  • 2
  • 17
  • 24
0

Maybe you can try json_encode() to save it to text field, if that is some very static data using only to read data once it is inserted (if you won't use Ordering, finding by some of array $var or similar), or if is(will be) very small table.