How to check if a string starts with a particular character in PHP?

You can use thesubstr function in php and find the first character is exist in string or not
if (substr('_abcdef', 0, 1) === '_') { ... }

Comments