Skip to content

Use of str_starts_with incompatible with PHP 7 #141

Description

@kirk-loretz-fsn

Version 2.3.2 added a use of str_starts_with via PR #113.

return str_starts_with($path, $key);

str_starts_with requires PHP 8, so the designation of this library as PHP 7.2 compatible is incorrect.

"php": ">=7.2",

Here is a polyfill:

function str_starts_with(string $haystack, string $needle): bool {
    return \strncmp($haystack, $needle, \strlen($needle)) === 0;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions