php-extended/polyfill-php80-str-utils

A php implementation of string functions introduced in php8 and above

1.1.0 2022-05-31 07:33 UTC

This package is auto-updated.

Last update: 2022-07-22 09:01:19 UTC


README

A php implementation of string functions introduced in php8 and above

coverage build status

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/polyfill-php80-str-utils": "^1",
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

This library gives the following functions :

  • str_contains(?string $haystack, ?string $needle) : bool
  • str_icontains(?string $haystack, ?string $needle) : bool
  • str_starts_with(?string $haystack, ?string $needle) : bool
  • str_istarts_with(?string $haystack, ?string $needle) : bool
  • str_ends_with(?string $haystack, ?string $needle) : bool
  • str_iends_with(?string $haystack, ?string $neede) : bool

Those functions follow the naming convention of str_ireplace, and the parameter placement of str_contains.

License

MIT (See license file).