<?php// check if string starts with a specific sub-string function startsWith($myString, $needle){ return !strncmp($myString, $needle, strlen($needle));} $mystr="Bombo anas"; if(startsWith($mystr,"B")==1) echo "String starts with B"; else echo "String doesn't start with B"; ?>