领先的免费Web技术教程,涵盖HTML到ASP.NET

网站首页 > 知识剖析 正文

字符串去符号转化为数组 #php

nixiaole 2024-11-23 20:37:18 知识剖析 17 ℃

字符串去符号转化为数组

所用到的函数为explode() 函数把字符串分割为数组
str_replace() 函数使用一个字符串替换字符串中的另一些字符。
explode(separator,string,limit)参数描述separator必需。规定在哪里分割字符串。string必需。要分割的字符串。limit可选。规定所返回的数组元素的最大数目。
例如$str="[16],[17],[18]";
$shuzhu=explode(",",$str));
即:Array
([0] =>16[1] => 17[2] =>18)
foreach ($shuzhuas $item) {
$member_id=str_replace("[","",$item); $member_id=str_replace("]","",$member_id);}

最近发表
标签列表