3v4l.org

run code in 300+ PHP versions simultaneously
<?php $month = [ 'January', 'January', 'January', 'January', 'February' ]; $weeks = [ 'Week 1', 'Week 2', 'Week 3', 'Week 4', 'Week 1' ]; $newArray = []; foreach ($month as $index => $value) { // Create the new string you want, using the same index for both arrays $newArray[] = $value . ' - ' . $weeks[$index]; } print_r($newArray);

preferences:
23.12 ms | 404 KiB | 5 Q