PHP code example of hyqo / string

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

    

hyqo / string example snippets


use function Hyqo\String\s;

echo s('FOO BAR')->lower()->upperFirst(); //Foo bar

use function Hyqo\String\s;
use Hyqo\String\SplitFlag;

s('foo#bar')->leftCrop('#'); //bar
s('foo#bar')->rightCrop('#'); //foo

s('foo, , bar')->split(','); // ['foo', ' ', ' bar']
s('foo, , bar')->split(',', SplitFlag::TRIM | SplitFlag::NO_EMPTY); // ['foo', 'bar']
s('foo, , bar')->splitStrictly(','); // ['foo', 'bar']