library/Garp/Util/String.php
static public function interpolate($str, array $vars) {
        $keys = array_keys($vars);
        $vals = array_values($vars);
        // surround keys by "%"
        array_walk(
            $keys, function (&$s) {
                $s = '%' . $s . '%';
            }
        );
        $str = str_replace($keys, $vals, $str);
        return $str;
    }
static public function interpolate($str, array $vars) {
        $keys = array_keys($vars);
        $vals = array_values($vars);
        // surround keys by "%"
        array_walk(
            $keys, function (&$s) {
                $s = '%' . $s . '%';
            }
        );
        $str = str_replace($keys, $vals, $str);
        return $str;
    }
static public function interpolate ( $ str , array $ vars ) { $ keys = array_keys ( $ vars ) ; $ vals = array_values ( $ vars ) ; // surround keys by "%" array_walk ( $ keys , function ( & $ s ) { $ s = '%' . $ s . '%' ; } ) ; $ str = str_replace ( $ keys , $ vals , $ str ) ; return $ str ; }
Interpolate strings with variables

@param string $str The string
@param array $vars The variables
@return string The interpolated string
Interpolate strings with variables