Unstoppable Domains

Suppose I have a string. And in it, PHP code that I WANT to be executed

Spaceship Spaceship
Watch

user-7256

VIP Member
Impact
111
Hi,

I have a string of text. Inside that string is:

<?php show_code(1); ?>

With "1" being any number. (which isn't important really). I want that PHP code to be executed as the string is echo()'d ... not hidden in the source, as it is now. It doesn't display on the webpage, but is in the source code (of View -> Source).

Any ideas?

Thanks,
-Matt
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Just to make sure I'm following you correctly, you have something like this now?

Code:
$string = "<?php show_code(1); ?>"

echo $string;

And your HTML source is displaying "<?php show_code(1); ?>", but you'd rather it be executed as PHP code?
 
0
•••
Yeah. Not all of the string is PHP code. for example,

Code:
$string = "This is my string. This should be displayed on the webpage.

<?php show_code(1); ?>

However, the above PHP tag should be executed.";

echo($string);

See what I mean? :p
 
0
•••
Have a look at the eval() php funciton,

http://us3.php.net/eval

If your string contains other text besides PHP commands like in your example, you'll probably need to do an "eregi" to split the PHP code out of the string and pass everything between the <? and ?> tags to the eval function.
 
0
•••
Okay, well, thanks ;)
 
0
•••

We're social

Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back