help with this loop guys

[eluser]billie joe[/eluser]
$data['getComment'] = $MusicCommentsx;

for ( $i = 0; $i <= count($data['getComment']) -1 ; $i++ ) {


$y= array($i);
$fruit = array_pop($y);
$data['total'] = $fruit;


i find some several way... hehe maybe my mind has a small rust Wink

Seems a very hacky way to do it :S
I thought when you said you got it working, you figured out why array_pop wasn;t recognizing it as an array

a speed tip, don't call the count function is the second segment of the for loop. This will call the count function on each iteration.

[eluser]Evil Wizard[/eluser]
you could have also just used...

$data[‘total’] = end($data[‘getComment’]);

that will move the array pointer to the end of the array and return the last element without modifying the original variable structure.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.