Re: funciones
| From: | Dr Zippie | Date: | Wed, 13 Nov 2002 16:59:31 +0000 |
| Subject: | Re: funciones | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-29192@lists.php.net to get a copy of this message | ||
Primero ... activa la visualización de errores ... con una linea como
error_reporting(E_ALL);
A partir de aquí verás todos los errores ... como el siguiente
echo "<td align=center>",func_get_arg($i),"</td>\n";
para concatenar una cadena se utiliza el punto (.) no la coma (,)
ó
echo "<td>$matriz[$i]</td>\n";
que debería ser echo "<td>" . $matriz[$i] . "</td>\n";
[...]
Lo dicho ... activa los errores ... y podrás empezar a ver donde "no funciona" tu script
_.-. _.-. _.-. _.-. EN RESPUESTA A _.-. _.-. _.-. _.-. _.-.
Carlos Carrera comentaba el [13/11/02-11:10] sobre " [PHP-ES] funciones":
>Amigos, una consulta, he hecho un programita en php y he aplicado
>funciones
>dentro de la cual he declarado las variables:
>
>func_num_arg()
>func_get_arg() y
>func_get_args()
>
>pero cuando ejecuto el programita en mi apache linux el browser se queda en
>blanco y no carga nada ni siquiera me muestra errores...
>
>el programita es:
>_______________
>
><?php
>function listar($matriz)
> {
> echo "<table border=3>\n";
> for ($i=0;$i < count($matriz); $i++)
> {
> echo "<tr>\n";
> echo "<td>Elemento $i</td>\n";
> echo "<td>$matriz[$i]</td>\n";
> echo "</tr>\n";
> }
> echo "</table>\n";
> }
>function media()
> {
> $limite=func_num_args();
> $acumulado=0;
> echo "<table width=175>\n";
> echo "<caption align=top>Número de argumentos: $limite</caption>\n";
> for ($i=0;Si<$limite;$i++)
> {
> echo "<tr>\n";
> echo "<td align=center>Parámetros $i </td>\n";
> echo "<td align=center>",func_get_arg($i),"</td>\n";
> echo "</tr>\n";
> $acumulado += func_get_arg($i);
> }
> echo "</tables>\n";
> listar(func_get_args());
> return $acumulado/$limite;
> }
>$valor_media = media(12, 13, 15);
>echo "<h2>Valor de la Media: ", $valor_media, "</h2>\n";
>?>
>___________
>
>Saludos...
>
>
>---------------------------------------------------------------------
>Archivo On-line: http://www.phpes.com/
> via news: news://news.phpes.com/
>Manual PHP en español: http://www.php.net/manual/es/
>Para dar de baja la suscripción, mande un mensaje a:
> lista-unsubscribe@phpes.com
Dr Zippie (zippie(a)dr-zippie.net)
www.dr-zippie.net ** en construcción **
"El ordenador es la evolucion logica del hombre: Inteligencia sin moral": John Osborne.
"A nullo videbatur, ipse autem omnia videbat"