<?php

$string="array.jpg,teste.pdf,word.docx";
$count=explode(",", $string);

for($i = 0; $i < count($count); $i++){ 
   echo $count[$i];
}