PHP code example of dcsg / stringy-template

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

    

dcsg / stringy-template example snippets



echo S::render(
    'Hello, my name is {firstName} {lastName}.',
    ['firstName' => 'Daniel', 'lastName' => 'Gomes']
); 
// "Hello, my name is Daniel Gomes."


// Using conversion specifications from `sprintf`
echo S::render(
    'I have {num%.1f} {fruit}.',
    ['num' => 1.5345, 'fruit' => 'oranges']
);
// "I have 1.5 oranges."

echo S::join(['one', 'two', 'three'], ', ');
// "one, two, three"