This question already has answers here:
Answer
Solution:
Try this:
You are getting the whole post object in the $speakerpostid array. You need to store only the post id.
$atts['speakersname'] = 'abc,xyz,prq'; // post title
$getspeakertitle = explode(',', $atts['speakersname']);
$speakerpostid = array();
foreach ($getspeakertitle as $value) {
$page_obj = get_page_by_title($value, OBJECT, 'speaker');
$speakerpostid[] = $page_obj->ID;
}
echo "<pre>";
print_r($speakerpostid);
Source