Saturday, February 6, 2010

php eval function usage

evalTest.php :

$str = '$db_name';
echo $str;
require 'utils.php';
evalTest($str);

utils.php :

function evalTest($str) {
require 'db_settings.php';
eval("\$str = \"$str\";");
echo $str;
}

db_setting.php :
$db_name = "mydb";

No comments:

Blog Archive