Make WordPress Core

Changeset 8111


Ignore:
Timestamp:
06/17/2008 03:07:42 AM (16 years ago)
Author:
ryan
Message:

Don't do sizeof() in a loop. Props DD32. see #7147

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/classes.php

    r7944 r8111  
    430430             ($max_depth != 0 &&  $max_depth > $depth+1 )) { //whether to descend
    431431
    432             for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
     432            $num_elements = sizeof( $children_elements );
     433            for ( $i = 0; $i < $num_elements; $i++ ) {
    433434
    434435                $child = $children_elements[$i];
     
    443444
    444445                    array_splice( $children_elements, $i, 1 );
     446                    $num_elements--;
    445447                    $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
    446448                    $i = -1;
Note: See TracChangeset for help on using the changeset viewer.