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

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

WBOY
Release: 2016-06-13 12:05:54
Original
1027 people have browsed it

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template