php-extended/polyfill-php80-str-utils

A php implementation of string functions introduced in php8 and above

1.3.7 2024-03-31 13:28 UTC

This package is auto-updated.

Last update: 2024-10-01 00:14:48 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 and the autoloading of all classes of this library is made through their autoloader.

  • Download composer.phar from their website.
  • Then run the following command to install this library as dependency :
  • php composer.phar php-extended/polyfill-php80-str-utils": "^1"

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).