0791280266601 [1] => "/>  0791280266601 [1] => ">

Home >Backend Development >PHP Tutorial >PHP 函数拆分,该怎么处理

PHP 函数拆分,该怎么处理

WBOY
WBOYOriginal
2016-06-13 11:47:55981browse

PHP 函数拆分
 $str = "0791280266601-5011";
 print_r (explode("-",$str));

 显示效果:Array ( [0] => 0791280266601 [1] => 5011 ) ;


=========================================
第一我要【0】的怎么拿到?
第二【1】怎么拿到? 现在是拆分开了,但是不知道怎么拿到?
大虾 求指点

------解决方案--------------------
$t = explode("-",$str);
echo $t[0];
echo $t[1];


------解决方案--------------------
版主大人的回复不就可以达到你想要的么,有撒问题?

------解决方案--------------------
$str = "0791280266601-5011";
$t = explode("-",$str);
echo $t[0]."
";
echo $t[1];

输出
0791280266601
5011

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