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? Quote 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(); Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.