<?php #Fake DB $cursos = array( 'imagem1' => 'nome1', 'imagem2' => 'nome2', 'imagem3' => 'nome3', 'imagem4' => 'nome4', 'imagem5' => 'nome5' ); function get_tabela(&$arr_cursos, $multiplos_de) { $n_linhas_tabela = ceil(count($arr_cursos) / $multiplos_de); $j = 0; for ($i = 0; $i < $n_linhas_tabela; $i++) { $output[] = get_linha($arr_cursos, $j, $multiplos_de); $j = $j + $multiplos_de; } return $output; } function get_linha(&$arr_cursos, $start_point, $multiplos_de) { $i = 0; foreach($arr_cursos as $img => $nome) { if ($i >= $start_point && $i <= $start_point + $multiplos_de - 1) { $arr_img[] = $img; $arr_nomes[] = $nome; } $i++; } return array($arr_img, $arr_nomes); } echo '<pre>' . print_r(get_tabela($cursos, 3)) . '</pre>'; ?>
Mas estou com problemas, será que alguem me pode ajudar?
É Urgente
Obrigado