PHP code example of klaussilveira / simple-string
1. Go to this page and download the library: Download klaussilveira/simple-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/ */
klaussilveira / simple-string example snippets
use Simple\Type\String;
// Example
$string = new String('Lorem ipsum dolor sit amet lorem ipsum');
$string->shorten(10);
$string->toSentenceCase();
echo $string;
// Fluent interface example
$string = new String('Lorem ipsum dolor sit amet lorem ipsum');
$string->shorten(15)->toCamelCase();
echo $string;
/**
* SimpleString also uses overloading to create an object-oriented
* interface for built-in string functions. Functions starting with
* str or str_ can just be used with their actual name, not prefix.
*
* So: strtolower = tolower, str_replace = replace.
*
* Functions whose return values are not string are invalid and will
* throw exceptions.
*/
$string = new String('Lorem ipsum dolor sit amet lorem ipsum');
$string->tolower()->replace('lorem', 'mortem');
echo $string;