Unstoppable Domains โ€” Get your daily AI drops report

[Resolved] Executing HTML-PHP code from variables

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
Watch

mignolo

Established Member
Impact
10
Executing HTML-PHP code from variables

The problem is:
I have html-php codes stored in mysql as strings... I query mysql and i obtain some variables like these:

$str_phpcode1 = "<div><?php echo "Hello world"; ?></div>";
$str_phpcode2 = "<span><?php func_loan(); ?></span>";
...

Obviously if I write
echo $str_phpcode1; or echo $str_phpcode2;
the strings will be printed as text and the "echo" and "func_loan()" are not executed as php code.

Is there a solution?
Thank you

Resolved:

eval("?>".$str_phpcode1."<?php ");
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
CatchedCatched
Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back