Home >Backend Development >PHP Tutorial >获取字符串中的字符有关问题

获取字符串中的字符有关问题

WBOY
WBOYOriginal
2016-06-13 12:05:541039browse

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

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

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