PHP删除指定字符。
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
$d = array(
0 => array(
'a' => string 'Days_3' (length=6)
'b' => string '3 Days' (length=6)
)
1 => array(
'a' => string 'Days_7' (length=6)
'b' => string '7 Days' (length=6)
)
2 => array(
'a' => string 'Days_14' (length=7)
'b' => string '14 Days' (length=7)
)
3 => array(
'a' => string 'Days_30' (length=7)
'b' => string '30 Days' (length=7)
)
4 => array(
'a' => string 'Days_60' (length=7)
'b' => string '60 Days' (length=7)
));
foreach($d as $v)
{
echo ltrim($v['a'],"Days_").",";
}
$ch = '';
foreach($d as $v)
{
echo $ch . ltrim($v['a'],"Days_");
$ch = ',';
}
<br><font color="#e78608">------解决方案--------------------</font><br>substr($str,0,-1)或者放入数组中。再用implode连接 <div class="clear"></div>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号