HH\Lib\Str\starts_with_ci

Meta Engineer?

This is available as Str\starts_with_ci in the www repository.

Returns whether the string starts with the given prefix (case-insensitive)

namespace HH\Lib\Str;

function starts_with_ci(
  string $string,
  string $prefix,
): bool;

For a case-sensitive check, see Str\starts_with().

Guide

Parameters

  • string $string
  • string $prefix

Returns

  • bool

Examples

$result = Str\starts_with_ci("example_string", "example");
echo($result);
//result: true

$result = Str\starts_with_ci("example_string", "EXAMPLE");
echo($result);
//result: true

$result = Str\starts_with_ci("example_string", "string");
echo($result);
//result: false