View Single Post
Old 03-01-2011, 12:49 AM   #3 (permalink)
wGEric
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 166
Thanks: 0
wGEric is on a distinguished road
Default

Your loop can be confusing. It isn't wrong but can be hard to understand what is going on since you are pretty much using it like a while loop.

PHP Code:
$i 0;
$total sizeof($out);
while(
$i $total) {
    
$value $out[$i][0];

    
$value str_replace("*&","<div class=\"progress-containers\"><div style=\"width:",$value);
    
$value str_replace("&*","%\">$value[$i][1]</div></div>",$value);
    
$i++;

PHP Code:
for($i 0$total sizeof($out); $i $total$i++) {
    
$value $out[$i][0];

    
$value str_replace("*&","<div class=\"progress-containers\"><div style=\"width:",$value);
    
$value str_replace("&*","%\">$value[$i][1]</div></div>",$value);

Here is how you would use a foreach loop.

PHP Code:
foreach($out as $val) {
    
$value $val[0];

    
$value str_replace("*&","<div class=\"progress-containers\"><div style=\"width:",$value);
    
$value str_replace("&*","%\">$value[$i][1]</div></div>",$value);

I didn't update variables in the HTML within the loop so those may be incorrect.
__________________
Eric
wGEric is offline  
Reply With Quote