what im trying to do, is retrieve something like this that is save in my database

PHP Code:
<div id="wrap">
<
div id="sidebar">
<<
$username>> <br/>
<<
$avatar>> <br/>

</
div>
<
div id="content">

fsjdflksjdf;lkasdj sdklfj s;dlkfjsd;lkfj;sdlfjs

</div>
</
div
and change it to something like this

PHP Code:
<div id="wrap">
<div id="sidebar">
<?php echo $username?> <br/>
<?php echo $avatar?> <br/>

</div>
<div id="content">

fsjdflksjdf;lkasdj sdklfj s;dlkfjsd;lkfj;sdlfjs

</div>
</div>
basically i want to change wherever it says << to <?php echo and i want to change anywhere that is says >> to ;?>


so it would work the same if i was retrieving this from my database

PHP Code:
<div>
<<
$username>>
<
div/> 
and change it to this
PHP Code:
<div>
<?php echo $username?>
<div/>
would that be possible. and it doesnt have to be << and >> it can be any indicator really. i just cant figure out how to use str_replace for this and havent found any other function