Warptweet Posted April 1, 2007 Share Posted April 1, 2007 When I use this code... $reply_text = str_replace("<usertag>", "".$_SESSION['s_username']."", $reply_text); It takes my username Warptweet (Because thats what I'm logged in with the session) but I don't want it to translate into my username, I want it to STAY as ".$_SESSION['s_username']." without changing into my username. How can I do this? Thanks for any help! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 1, 2007 Share Posted April 1, 2007 You probably want to do something like this: <?php $reply_text = str_replace("<usertag>", "\$_SESSION['s_username']", $reply_text); ?> which should prevent it from being expanded. Ken Quote Link to comment Share on other sites More sharing options...
tbone542 Posted April 1, 2007 Share Posted April 1, 2007 Could single quotes be used instead of double quotes around the variable to prevent php from entering the value of the variable? T Quote Link to comment Share on other sites More sharing options...
Warptweet Posted April 1, 2007 Author Share Posted April 1, 2007 Sorry, this doesn't work. Neither methods work Do you two or somebody else have any other idea? Quote Link to comment Share on other sites More sharing options...
tbone542 Posted April 1, 2007 Share Posted April 1, 2007 $reply_text = str_replace("<usertag>", '\".$_SESSION['s_username'].\"', $reply_text); Maybe? T Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 1, 2007 Share Posted April 1, 2007 What doesn't work about my method. I just tried it and it worked fine. So does <?php $reply_text = str_replace("<usertag>", '$_SESSION["s_username"]', $reply_text); ?> Ken Quote Link to comment Share on other sites More sharing options...
Warptweet Posted April 1, 2007 Author Share Posted April 1, 2007 Oh, I used '. and .' instead of ' and ' Quote Link to comment 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.