Something like that ? (i am using a function do_eval() using php function eval() function do_eval($string) { ob_start(); echo(eval(' ?>' . $string)); $newstring = ob_get_contents(); ob_end_clean(); return $newstring; }