数组在PHP中减慢程序[关闭]

数组在PHP中减慢程序[关闭]

问题描述:

I have a problem in CodeIgniter, I am running this code.

With it my PHP code doesn't finish. The view absolutely refuses to load. It just shows loading.

$gen1 is an array on the server side and I pass it with

$data['gen1']=$gen1;
$this->load->view('name',$gen1);

On the client side

 <?php for($i=1;$i<=count($gen1);$i):?>
           <a href="#" class="linktoquestion"><?php echo $i;?></a>
 <?php endfor;?>

$gen1 is an array of only 3 objects.

Each object has around 5 or 6 fields.

Look closely at your for loop. $i never changes, so it'll be an infinite loop.

You probably want

 <?php for($i=1;$i<=count($gen1);$i++):?>