$variables Known variable name => value (without braces), e.g. ['title' => 'Post Title']. * @return string */ public static function resolve( string $template, array $variables ): string { $search = array(); $replace = array(); foreach ( $variables as $name => $value ) { $search[] = '{{' . $name . '}}'; $replace[] = $value; } return str_replace( $search, $replace, $template ); } }