将新数组分配给foreach循环[关闭]

I'm looking for the best way to go through an array and assign a second array and loop it. Below is a basic outline of the array I want to use.

$firstarray = array('one','two','three','four', 'five', 'six');
$secondarray = array('blue', 'green', 'pink');

I would like it to print out

one = blue
two = green
three = pink
four = blue

and so on..

Sorry if this doesn't make sense. New to php and stackexchange.

$firstarray  = array('one', 'two', 'three', 'four', 'five', 'six');
$secondarray = array('blue', 'green', 'pink');

foreach($firstarray as $index => $value)
  echo $value . ' = ' . $secondarray[$index % count($secondarray)] . PHP_EOL;

Use index of elements of $firstarray as counter, take modulo from it by the number of the elements in $secondarray (loop through the second array) and output the string.

I think you are looking for a multi-dimension array. We can't see how you are building the array, so it's hard to give you much help without more code. The array would look something like this:

$multi_array = array ( 
    array("number"=>"one","color"=>"blue"), 
    array("number"=>"two","color"=>"green")
)

Then you could print it like this:

foreach($multi_array as $array){
     echo $array["number"]." = ".$array["color"];
}