Problem with iterating an array in php

0

I have the following code.

$array = array(1,2,3);
$arr1 = array(3, 4, 5);


$data = [];

for($i = 0; $i < count($array); $i++){

    $data["ca"] = $array[$i];

    for($k = 0; $k < count($arr1); $k++){

        $data["ser"] = $arr1[$k];
    }

}

print_r($data);

The idea is for it to scroll through the entire array, which it is not doing, and as it traverses it it prints as follows:

Array ( [ca] => 1 [ser] => 3 )
Array ( [ca] => 2 [ser] => 4 )
Array ( [ca] => 3 [ser] => 5 )
    
asked by anonymous 18.06.2018 / 21:14

0 answers