PHP code example of funch / re

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

    

funch / re example snippets




use Funch\ReStatic as Re;

$text = 1234;

echo Re::pattern('12')
    ->subject($text)
    ->replace(56); // 5634

print_r(
    Re::subject([
        $text,
        'hello, PHP'
    ])->replace([
        '/12/' => '00',
        '/php/i' => 'China'
    ])
);
// Array
// (
//     [0] => 0034
//     [1] => hello, China
// )