Home  >  Article  >  Backend Development  >  获取字符串中的字符问题

获取字符串中的字符问题

WBOY
WBOYOriginal
2016-06-23 13:50:33900browse

例如我想获取"10t2"当中的10和2两个字符
用了strstr()函数,把T也截取出来了,
这个要怎么获取呢?


回复讨论(解决方案)

$str='10t2';$a=substr($str,0,2);  //10$b=substr($str,3,1);  //2

$str='10t2';$a=substr($str,0,2);  //10$b=substr($str,3,1);  //2


你这样只能找一个字符串的,我有很多类似的字符串,数字都不是一样的,我找到方法了,还是谢谢你!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn