fn php_visit_result_with_template(val: &ext_php_rs::types::Zval, tmpl_vars: &[(&str, &str)]) -> {{ core_crate }}::VisitResult {
    let base = php_zval_to_visit_result(val);
    if let {{ core_crate }}::VisitResult::Custom(tmpl) = base {
        let mut s = tmpl;
        for (k, v) in tmpl_vars {
            s = s.replace(&format!("{% raw %}{{{}}}{% endraw %}", k), v);
        }
        {{ core_crate }}::VisitResult::Custom(s)
    } else {
        base
    }
}
