PHP code example of youhey / c-sharp-ish-string-formatter

1. Go to this page and download the library: Download youhey/c-sharp-ish-string-formatter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

youhey / c-sharp-ish-string-formatter example snippets


use Youhey\StringFormatter\Formatter;

// output "はじめまして 世界!"
echo (new Formatter("{hello} {world}!"))->compile(["hello" => "はじめまして", "world" => "世界"]);

// output "hello world!"
echo (new Formatter("{0} {1}!"))->compile("hello", "world");