goocharlton Posted August 18, 2007 Share Posted August 18, 2007 I am trying to use this code.... <?php include("news_items.php"); foreach ($news as $value) { echo "<p>"; echo "<b>" .$value[date]. "</b><br>"; echo $value[content]; echo "<p>"; } ?> ...inside a simple variable like so... <?php $variable = include("news_items.php"); foreach ($news as $value) { echo "<p>"; echo "<b>" .$value[date]. "</b><br>"; echo $value[content]; echo "<p>"; } ?> As you would already know this doesn't work. How do I achieve this? Link to comment https://forums.phpfreaks.com/topic/65584-adding-pgp-to-a-variable-help/ Share on other sites More sharing options...
MadTechie Posted August 18, 2007 Share Posted August 18, 2007 news_items.php funtion GetSomeData() { $tmp = ""; foreach ($news as $value) { $tmp .= "<p>"; $tmp .= "<b>" .$value[date]. "</b><br>"; $tmp .= $value[content]; $tmp .= "<p>"; } return $tmp } other php script include("news_items.php"); $variable = GetSomeData(); Link to comment https://forums.phpfreaks.com/topic/65584-adding-pgp-to-a-variable-help/#findComment-327472 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.