3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dias = array('Domingo','Lunes','Martes','Miercoles','Jueves','Viernes','Sabado'); $mes = array(); //Recorro 4 semanas for($i=0;$i<4;$i++){ //Por cada semana recorro la cantidad de dias que tiene la semana. $diasSemana = count($dias); for($j=0;$j<$diasSemana;$j++){ //En la posicion correcta Semana => Dia, ubico el nombre del dia $mes[$i][$j] = $dias[$j]; } } print_r($mes); /* foreach ($mes as $cuatro){ echo "<br>"; foreach ($dias as $di){ echo $di; "<br>"; } */ ?>
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( [0] => Domingo [1] => Lunes [2] => Martes [3] => Miercoles [4] => Jueves [5] => Viernes [6] => Sabado ) [1] => Array ( [0] => Domingo [1] => Lunes [2] => Martes [3] => Miercoles [4] => Jueves [5] => Viernes [6] => Sabado ) [2] => Array ( [0] => Domingo [1] => Lunes [2] => Martes [3] => Miercoles [4] => Jueves [5] => Viernes [6] => Sabado ) [3] => Array ( [0] => Domingo [1] => Lunes [2] => Martes [3] => Miercoles [4] => Jueves [5] => Viernes [6] => Sabado ) )