I need a function that replace every variable_name inside \'{}\' with the correct variable. Something like this:
$data[\"name\"] = \"Johnny\"; $data[\"age\"
You can try out vsprintf it has slightly different syntax
$string = 'hello my name is %s and I am %d years old'; $params = array('John', 29); var_dump(vsprintf($string, $params)); //string(43) "hello my name is John and I am 29 years old"