php的foreach 同时遍历两个数组并输出

2024-12-21 21:29:01
推荐回答(4个)
回答1:

$a=array("h1","h2","h3");
$b=array("c1","c2","c3");


for($a as $key => $value)

{

    echo $value . $b[$key];

}


希望能够帮到你

$a=array("h1","h2","h3");
$b=array("c1","c2","c3");

for($a as $key => $value)
{
    echo $value . $b[$key];
}

回答2:

$a = ;
$b= ;
    foreach($a as $k=>$va){
        echo $va.$b[$k];
    }
?>

手打,望采纳

回答3:

出队 array_shift

回答4:

$a=array("h1","h2","h3");$b=array("c1","c2","c3"); foreach($a as $key => $value){ echo $value . $b[$key];}