This librairy provides utilities function to ease string manipulation
Install package with composer
composer require webikevn/wstring
In your PHP code, load library
require_once __DIR__ . '/../vendor/autoload.php';
use Webike\WString\WString as WString;
Note: I couldn't use String as namespace because it's a PHP reserved word so it's why namespace is WString ...
Replace the last occurrence of a string
$string = WString::strReplaceLast($search, $replace, $subject);
Checks whether a string starts with given chars
$bool = WString::startsWith($haystack, $needle);
Checks whether a string ends with given chars
$bool = WString::endsWith($haystack, $needle);
phpunit --bootstrap vendor/autoload.php tests
Nguyen Giang visit my website ;)