I would like to learn how can I turn PHP String into a PHP script.
e.g.
$var = "echo 'Hello';";
and execute as
echo 'Hello';
If you need more detail or similar post exist please let me know.
I would like to learn how can I turn PHP String into a PHP script.
e.g.
$var = "echo 'Hello';";
and execute as
echo 'Hello';
If you need more detail or similar post exist please let me know.
Just use eval function see this link https://www.w3schools.com/php/func_misc_eval.asp
You can do it by the PHP function eval. https://www.php.net/manual/en/function.eval.php
e.g:
$var = "echo 'Hello';";
eval($var);
// output:
// Hello
But take care it is an big security issue (it is not save and not good).