PHP code example of peterviergutz / pattern

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

    

peterviergutz / pattern example snippets



 use Pattern\Pattern;
 
 $pattern = new Pattern('{path}/{name}_{startDate}-{endDate}.{extension}');
 $variables = $pattern->parse('/path/to/file/update_XY_example.com_20180917-20180923.csv');


 use Pattern\Pattern;
 
 $pattern = new Pattern('SELECT {columns} FROM {table} LIMIT {limit}');
 $variables = $pattern->parse('select foo from bar limit 42');