PHP within a PHP variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dscovil
Forum Newbie
Posts: 1
Joined: Thu Jan 24, 2008 3:38 pm

PHP within a PHP variable

Post by dscovil »

Hi I'm very new to PHP. I am just trying to nest PHP in a variable. On my inside.php page I have the following code where a sidebar is supposed to be.

Code: Select all

<? echo "$insidesidebar"; ?>
Then on the interior page I have the following php not just put a string in the variable but to include another bit of php for a sidebar blog.

Code: Select all

$insidesidebar = '<?php echo $sideData; ?>';
Of course this isn't working. Please let me know a better way.
User avatar
markusn00b
Forum Contributor
Posts: 298
Joined: Sat Oct 20, 2007 2:16 pm
Location: York, England

Re: PHP within a PHP variable

Post by markusn00b »

Why would you want to nest it inside?

Just echo it out like normal..
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP within a PHP variable

Post by Christopher »

Where is the other "bit of php for a sidebar blog" located. Do you generate it as a sting or is it in a separate file?
(#10850)
Post Reply