PHP100 2019-03-27
代码如下:
//将多维数组中所有的数值转换成字符串――――》最多支持三维数组 function implodex( $glue, $array, $separator='' ) { if ( ! is_array( $array ) ) return $array; $string = array(); $count = 0; foreach ( $array as $key => $val ) { if ( is_array( $val ) ) $val = implode( $glue, $val ); if($count == 0){ $string[] = "{$val}"; }else{ $string[] = "{$glue}{$val}"; } } if(empty($separator))$separator = $glue; return implode( $separator, $string ); }