$push = $result; $push = json_decode($push, true); foreach ($push['rows'] as $item) { echo $item['ad_campaign_id'] . ','; } get only numbers values
function get_number_from_string($string) { preg_match_all('!\d+!', $string, $matches); return $matches[0]; }