How do I use php to only accept values that begin with “09”? For example, only value 1 and value 3 should be accepted in this list:
value 1 ="09888111222";
value 2 ="02999111222";
value 3 ="09999111111";
i done it…
$cno="09888111222";
$countc=strlen($cno);
$countc1=-$countc+2;
$rest = substr($cno, 0, $countc1);
if($rest==07){
echo $rest;
}else{
echo "Value not starts with 07";
}
http://php.net/substr