PHP code example of mooeypoo / funcystr

1. Go to this page and download the library: Download mooeypoo/funcystr 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/ */

    

mooeypoo / funcystr example snippets



FuncyStr\FuncyStr;

$fstr = new FuncyStr([
    'PRONOUN' => function($params, $he, $she, $they) { return ($params['pronoun'] ?? '') === 'he' ? $he : (($params['pronoun'] ?? '') === 'she' ? $she : $they); },
    'PLURAL' => function($params, $one, $plural) { return ($params['plural'] ?? false) ? $plural : $one; },
]);

echo $fstr->process('This is a {{PRONOUN|he|she|they}}.', ['pronoun' => 'he']);