PHP如何用explode拆分数组
$slarray=array("45:01:02","32:03:04");foreach($slarrayas$key=>$v){$prsd=explode(':',$...
$slarray = array("45:01:02","32:03:04");
foreach($slarray as $key=> $v){
$prsd = explode(':',$v);
$cfh = '<span class="zs">'.$prsd[0].':</span><span class="xs">'.$prsd[1].'</span>';
echo $cfh.'<br>';
}
/*
现在输入的结果是这样的
<span class="zs">45:</span><span class="xs">01</span>
<span class="zs">32:</span><span class="xs">03</span>
我想要的结果
<span class="zs">45:</span><span class="xs">01:02</span>
<span class="zs">32:</span><span class="xs">03:04</span>
*/ 展开
foreach($slarray as $key=> $v){
$prsd = explode(':',$v);
$cfh = '<span class="zs">'.$prsd[0].':</span><span class="xs">'.$prsd[1].'</span>';
echo $cfh.'<br>';
}
/*
现在输入的结果是这样的
<span class="zs">45:</span><span class="xs">01</span>
<span class="zs">32:</span><span class="xs">03</span>
我想要的结果
<span class="zs">45:</span><span class="xs">01:02</span>
<span class="zs">32:</span><span class="xs">03:04</span>
*/ 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询