Welcome Guest, Not a member yet? Register   Sign In
help with this loop guys
#11

[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;

print_r($data['total']);


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

[eluser]Dam1an[/eluser]
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
#13

[eluser]xwero[/eluser]
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.
#14

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

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

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




Theme © iAndrew 2016 - Forum software by © MyBB