发布网友 发布时间:2022-04-06 07:26
共2个回答
热心网友 时间:2022-04-06 08:55
<?php
$test = array("key1"=>"value1","key2"=>"value2","key3"=>"value3");
foreach($test as $key=>$value){
$test[$key] = $key.$value;
}
foreach($test as $key=>$value){
echo $key,":",$value,"<br/>";
}
?>
将输出
key1:key1value1
key2:key2value2
key3:key3value3
热心网友 时间:2022-04-06 10:13
<?php
$arr["tmp1"]="value1";
$arr["tmp2"]="value2";
foreach( $arr as $key => $val ){
$arr[$key] = $key . "|" . $val ;
}
print_r($arr);
?>