假设以下是我们的包含字母和数字的字符串-
$value ="1045632245555fghjklm67535454663443gfdjkbvc9890000006777743";
我们输入从989开始的特定值,即
9890000006777743
为此,请substr()
与一起使用strpos()
。
<!DOCTYPE html> <html> <body> <?php $value ="1045632245555fghjklm67535454663443gfdjkbvc9890000006777743"; echo "The actual value is=",$value,"<br>"; $result=substr($value, strpos($value,"989"), 16); echo "The filter value is=",$result; ?> </body> </html>
输出结果
The actual value is=1045632245555fghjklm67535454663443gfdjkbvc9890000006777743 The filter value is=9890000006777743