Help me on displaying the contents of array
The script gets the content and images from a blog site. A post may have 1 or more images. So what it does, it gets the content of the blog and all the images related to the post. After that, with the double foreach loop it displays the content and the images urls. I am trying to combine the current post's content and images in one or two variables. So I will be able to show the content with an easy way like a for loop and a variable like $varcontent[$i]开发者_高级运维
echo $varcontent[4]["content"]; //shows the content
echo implode('<br/>', $varcontent[4]["images"]); //shows the images
because $varcontent[4]["images"]
is an array;
So need to use loop or use implode
function of php
Use either
foreach($varcontent[4]["images"] as $image){
echo $image; echo "<br>";
}
Or
echo implode('<br/>', $varcontent[4]["images"]);
精彩评论