PHP code example of awssat / str-helper

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

    

awssat / str-helper example snippets


str('Hi World')->replace(' ', '+')->lower();

str('<html>hi</html>')
            ->ifContains('hi')
            ->upper();
>> <HTML>HI</HTML>       

str('<html>hi</html>')
            ->if(function(){
                    return $this->contains('hi');
            })
            ->upper();
>> <HTML>HI</HTML>       

StrHelper::capitalize('life');

str()::capitalize('nomad');
bash
if(str('Hi')->lower->get() == 'hi') {
        echo 'yes'; 
}
>> yes
bash
str('LINK.COM')->tap(function($v){ print($v); })->lower();
>> LINK.COM
bash
str('<a>link.com</a>')->do(function($string){ 
        return strip_tags($string); 
});
>> link.com
bash
str('<a>link.com</a>')->do(function(){   
        $this->stripTags();
});
>> link.com