PHP code example of php-filter / string

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

    

php-filter / string example snippets

+HTML
$filter = Filter::of('/_big_ball_of_mud_/')
            ->replace('/', '')
            ->replace('_', '')
            ->upperWords();

$filter->valueString(); // 'Big Ball Of Mud'


$filter = Filter::of('/_big_ball_of_mud_/')
            ->replace('/', '')
            ->replace('_', '')
            ->upperWords();

$filter->valueString(); // 'Big Ball Of Mud'

$groupFilters = function ($value) {
	return Filter::of($value)->trim()->upperFirst()->append('.');
};

$filter = $groupFilters(' wikipedia is a free online encyclopedia');

$filter->valueString(); // 'Wikipedia is a free online encyclopedia.'


$filter = Filter::of(10.00)->value()->int() // 10
$filter = Filter::of(10.00)->value()->string() // '10.00'
$filter = Filter::of(true)->value()->string() // 'true'
$filter = Filter::of(null)->value()->intOrNull() // null

$info = Filter::of('wikipedia is a free online encyclopedia, created and edited by by volunteers')->info();

$info->length(); // 76
$info->wordsCount(); // 12
$info->phaseCount('ee'); // 2