# independent-analytics/1.24.0/IAWP/Utils/String_Util.php

Independent Analytics – WordPress Analytics Plugin, version 1.24.0. 29 lines.

- Page: https://pluginprobe.com/plugins/independent-analytics/1.24.0/code/IAWP/Utils/String_Util.php
- Raw: https://pluginprobe.com/plugins/independent-analytics/1.24.0/raw/IAWP/Utils/String_Util.php
- Modified: 2023-05-05T13:53:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/independent-analytics/1.24.0/code/IAWP/Utils/String_Util.php#L10-L20`.

```php
<?php

namespace IAWP_SCOPED\IAWP\Utils;

class String_Util
{
    /** These functions are copied verbatim from the WordPress polyfills added in 5.9.
     *  They allow us to use these PHP 8 functions with PHP 7 and WP 5.5 */
    public static function str_contains($haystack, $needle)
    {
        return '' === $needle || \false !== \strpos($haystack, $needle);
    }
    public static function str_starts_with($haystack, $needle)
    {
        if ('' === $needle) {
            return \true;
        }
        return 0 === \strpos($haystack, $needle);
    }
    public static function str_ends_with($haystack, $needle)
    {
        if ('' === $haystack && '' !== $needle) {
            return \false;
        }
        $len = \strlen($needle);
        return 0 === \substr_compare($haystack, $needle, -$len, $len);
    }
}

```
