PHP code example of gears / string

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

    

gears / string example snippets


use Gears\String\Str;

echo Str::s('fòô     bàř')->removeWhitespace()->swapCase(); // 'FÒÔ BÀŘ'
 php
$str = Str::s('fòôbàř');
foreach ($str as $char) {
    echo $char;
}
// 'fòôbàř'
 php
$str = Str::s('fòô');
count($str);  // 3
 php
$str = Str::s('bàř');
echo $str[2];     // 'ř'
echo $str[-2];    // 'à'
isset($str[-4]);  // false

$str[3];          // OutOfBoundsException
$str[2] = 'a';    // Exception