PHP:在图像上画一条线

for($c = 0; $c < $count-1; $c++){

$combine = $path[$c].$path[$c+1];

switch($combine){
    case "13":
        imagelinethick($img,1000,1000,500,500,$red,$thick=20);
        return(imagepng($img));
        break;
    case "36":
        imagelinethick($img,1000,1000,1200,1500,$red,$thick=20);
        return(imagepng($img));
        break;
    case "65":
        imagelinethick($img,1200,1500,3500,200,$red,$thick=20);
        return(imagepng($img));
        break;
    default:
        echo "hehehe";
    }
}

Inside the $path = array() is 1365

And I am trying to draw a line on an image. The problem is whenever it finds a case it the whole loop stops. Does return() can break a loop ? Any suggestions to improve this work ?

Thank you in advance