nesiak Posted September 9, 2007 Share Posted September 9, 2007 Is this possible ? (for those of you who don't understand what am i trying to ask: <?php echo '<?php echo "This is what i'm trying to do!"; ?>'; ?> ) Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/ Share on other sites More sharing options...
SirChick Posted September 9, 2007 Share Posted September 9, 2007 the result will show: <?php echo "This is what i'm trying to do!"; ?> NOT This is what I'm trying to do! If that is what you want it to do ? Or did you want to get the latter? Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/#findComment-344843 Share on other sites More sharing options...
nesiak Posted September 9, 2007 Author Share Posted September 9, 2007 yes but that result will not be shown as php code. In the view source window that php code is shown and is in italics. I want to echo that text.... <?php echo '<?php echo "This is what i'm trying to do!"; ?>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/#findComment-344850 Share on other sites More sharing options...
wildteen88 Posted September 9, 2007 Share Posted September 9, 2007 use htmlentities: <?php echo htmlentities('<?php echo "This is what i\'m trying to do!"; ?>'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/#findComment-344852 Share on other sites More sharing options...
nesiak Posted September 10, 2007 Author Share Posted September 10, 2007 I'm sorry but that doesn't do the trick. It just prints out that code ( as text ?) Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/#findComment-345301 Share on other sites More sharing options...
micah1701 Posted September 10, 2007 Share Posted September 10, 2007 then what are you asking? what final result are you looking for? Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/#findComment-345303 Share on other sites More sharing options...
NArc0t1c Posted September 10, 2007 Share Posted September 10, 2007 Eval function maybe? <?php echo eval('echo \'hello\'; '); ?> Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/#findComment-345306 Share on other sites More sharing options...
MadTechie Posted September 10, 2007 Share Posted September 10, 2007 i think you need to re-praise the question.. whats the goal? as wildteen88 solution is what i thought you wanted! either that or you wish parse code from another source, e.g. you have some "text" in a database and what that to be executable.. if thats the case then you could use eval. ie <?php $code = 'echo "testing";'; eval($code); ?> Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/#findComment-345307 Share on other sites More sharing options...
nesiak Posted September 10, 2007 Author Share Posted September 10, 2007 No matter i was just complicating things. I fixed it without using that other echo command.... Quote Link to comment https://forums.phpfreaks.com/topic/68603-is-there-a-way-to-echo-an-echo-command/#findComment-345318 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.