get_attachment_id() only get id of first attached image after post update

after 3 days i found the problem was because of an space in end of urls in $imgList array (Except last url) !!! so i added trim for each url ($value) and solved problem …

<?php

$img = get_post_meta( get_the_ID(), 'pics', true);
$imgList = explode("\n", $img);
$attach_ids = array();

foreach ( $imgList as &$value ) {
    if ( strpos( $value, 'http:' ) !== false ) {
        $value = trim($value);
        $attachment_id = get_attachment_id( $value );
        array_push($attach_ids, $attachment_id);
    }
}

$images = update_field( 'slider_portfolio', $attach_ids, get_the_ID() ); 
$images = get_field('slider_portfolio');

?>

there isn’t any problem with get_attachment_id() function. it’s perfect !