fork download
  1. <?php
  2.  
  3. //Monta um array igual ao da pergunta
  4. $valores = array("125", "148", "157", "169", "185");
  5. for($i=0; $i<5; $i++){
  6. $obj = new stdClass();
  7. $obj->ID = $valores[$i];
  8. $rows[] = $obj;
  9. }
  10.  
  11. $all_ids = array_map(function($item){ return $item->ID; }, $rows);
  12. echo implode(',', $all_ids);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
125,148,157,169,185