-
-
/**
- desc:递归替换数组内容
- link:bbs.it-home.org
- date:2013/2/22
- */
- function arrContentReplact($array)
- {
- if(is_array($array))
- {
- foreach($array as $k => $v)
- {
- $array[$k] = arrContentReplact($array[$k]);
- }
- }else
- {
- $array = str_replace(
- array(''),
- array('{', '}'),
- $array
- );
- }
- return $array;
- }
//调用示例
- $arr = array(array("","",array("",array(""))),"","","");
- $arr3 = arrContentReplact($arr);
- echo "
";
- print_r($arr3);
- echo "";
- ?>
复制代码
|