0

I set my foreach result in a array variable, the array give me some id's,

$categoryIDs = explode(',', $result->category_id);

I tried already to find solution but nothing works, any sources are: Converting indexed array to normal or simple array How to convert an array to object in PHP? Display array elements as normal CSV - PHP

If i show result with print_r() i see correct result, but how can i convert it into: 32,432,21,543?

Community
  • 1
  • 1
m_73
  • 569
  • 2
  • 5
  • 14
  • 2
    You should post `var_dump()`'s of the variables concerned, but you are probably looking for `implode()` instead of `explode()`. – jeroen Oct 01 '14 at 23:13

1 Answers1

1

You can use implode for this:

implode(",", $categoryIDs);

You can read the document here.

Peter Pei Guo
  • 7,770
  • 18
  • 35
  • 54