<?php /** * Tabla de multiplicar de $a, $b * * @param int $a * @param int $b * @return array $c */ function TablaMultiplicar($rows, $columns) { for ($a = 0; $a <= $rows; $a++) { for ($b = 0; $b <= $columns; $b++) { if ($a == 0) { $c[$a][$b] = $b; } elseif ($b == 0) { $c[$a][$b] = $a; } else { $c[$a][$b] = $a * $b; } } } return $c; } var_dump(TablaMultiplicar(10, 10));
<?php include_once '../modules/Application/src/Application/Model/TablaMultiplicar.php'; include_once '../modules/Application/src/Application/Model/Fibonacci.php'; include_once '../modules/Application/src/Application/Model/DibujarArray.php'; $a = 9; $b = 4; $max = 35; $arraytabla = TablaMultiplicar($a, $b); $arrayfibo = Fibonacci($max); DibujarArray($arraytabla); DibujarArray($arrayfibo);
<?php // phpinfo(); include "../modules/Application/src/Application/Model/TablaMultiplicar.php"; include "../modules/Application/src/Application/Model/Fibonacci.php"; include "../modules/Application/src/Application/Model/DibujaArray.php"; $a = 5; $b = 6; $max = 35; $tabla = TablaMultiplicar($a, $b); $fibo = Fibonacci($max); DibujaArray($tabla); DibujaArray($fibo);