excerpt display same text

You need to be using setup_postdata($post); as in all of the examples for get_posts. You need:

$myposts = get_posts('numberposts=5');
foreach($myposts as $post) :
    setup_postdata($post);
    // the rest of your function