<?php
$str = 'nilpointer.net';
$keyword = 'nil';
if (str_starts_with($str, $keyword)) {
echo 'The string starts with "'.$keyword.'"';
} else {
echo 'The string does not starts with "'.$keyword.'"';
}
?>
Output
The string starts with "nil"