HH\Lib\Str\starts_with
Returns whether the string starts with the given prefix
namespace HH\Lib\Str;
function starts_with(
string $string,
string $prefix,
): bool;
For a case-insensitive check, see Str\starts_with_ci()
.
Guide
Parameters
string $string
string $prefix
Returns
bool
Examples
$result = Str\starts_with("example_string", "example");
echo($result);
//result: true
$result = Str\starts_with("example_string", "EXAMPLE");
echo($result);
//result: false
$result = Str\starts_with("example_string", "string");
echo($result);
//result: false