I am trying to create a newline character in my foreach loop. After the URL I am trying to create a newline and then have a "------" between the title and content. After this there is supposed to be a space between the next URL. I have the space but I can't seem to get the line break. When I echo "\t" or "\n" in the loop nothing happens. When I use HTML in the loop it won't work, gives too many spaces.
for($i=0; $i < 4 ;$i++)
{
foreach ($json as $URL)
{
echo $URL ['results'][$i]['url'];
echo "---------------";
foreach ($json as $TITLE)
{
echo $TITLE ['results'][$i]['title'];
echo "--------";
}
foreach ($json as $content)
echo $content['results'][$i]['content'];
echo "---------------- ";
}
}
Is there a function in php besides "\n" or another way of manipulating the HTML to insert the line break?
TIA
' – Bharu Jul 11 '13 at 11:14
or nl2br() – Ali Almoullim Jul 11 '13 at 11:16
"; in the first foreach loop it gives me the url, 3 spaces and then the title and content. I'm thinking it must have something to do with the foreach loop itself – Daniel o keeffe Jul 11 '13 at 11:31
" which works perfectly, and gives me an idea on another problem as to how to hyperlink the urls. Thanks guys. – Daniel o keeffe Jul 11 '13 at 11:36