How to check if a string starts with another string - PHP
Using strpos
function can be achieved.
if (strpos($yourString, "repair") === 0) {
//Starts with it
}
Using substr
can work too:
if (substr($yourstring, 0, strlen($startString)) === $startString) {
//It starts with desired string
}
For multi-byte strings, consider using functions with mb_
prefix, so mb_substr
, mb_strlen
, etc.