function all_images(&$post){
$content = $post->post_content;
if(preg_match_all('/<img[^>]+src="(.*?)"[^>]*>/', $content, $results)){
$i = 0;
$count = count($results);
$count = $count - 1;
while($i < $count)
{
foreach($results as $result){
echo $result[$i];
}
$i++;
}
}
}
The above loop manages to get all of the images out of the original text. However, it only returns one image. I have tried several different combinations of while() and foreach() but it only ever returns one image. Does anyone know what i am doing wrong? Thanks