Cita:
Iniciado por portalmana
Aparte de lo que te mencionaron antes, me parece que tu código va a entrar en bucle infinito...
Revisalo antes de ejecutar...
Saludos
Si ya lo corregi ahora tengo otro problema
Código:
<?php
$a = new prueba();
$a->inicia();
$a->recorrer();
class prueba
{
static $numIndex;
function inicia()
{
$this->numIndex = 0;
}
function recorrer()
{
while ($this->numIndex < 10)
{
echo $this->numIndex, '<br>';
$this->numIndex = $this->numIndex + 1;
echo $this->numIndex, '<br>';
if (($this->numIndex%2)==0)
{
$this->recorrer();
}
}
}
}
?>
echo $this->numIndex, '<br>';
me imprime 1
$this->numIndex = $this->numIndex + 1;
echo $this->numIndex, '<br>';
luego me vuelve a imprimir 1 se su pone que numIndex + 1 me debe incrementar pero recien lo hacer al siguiente
Porque sale asi?
Saludos