首页 > 编程学习 > php 字符串和数组的相互转换

php 字符串和数组的相互转换

发布时间:2022/11/24 23:24:33
//将数组合成一个变量,用|符分格;
$new=implode("|",array("a"=>"a","b","c","d","e","f","g"));echo "变量值为:";
echo $new;
echo "<br>\n";//将变量拆分成数组
$b=explode('|',$new);
foreach ($b as $key => $value) {
echo "数组 $key 的值= $value<br>\n";}


本文链接:https://www.ngui.cc/el/2111914.html
Copyright © 2010-2022 ngui.cc 版权所有 |关于我们| 联系方式| 豫B2-20100000