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

git-svn-id: https://develop.svn.wordpress.org/trunk@8111 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-06-17 03:07:42 +00:00
parent 8293447648
commit f46c926a06

View File

@ -429,7 +429,8 @@ class Walker {
if ( $max_depth == 0 ||
($max_depth != 0 && $max_depth > $depth+1 )) { //whether to descend
for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
$num_elements = sizeof( $children_elements );
for ( $i = 0; $i < $num_elements; $i++ ) {
$child = $children_elements[$i];
if ( $child->$parent_field == $element->$id_field ) {
@ -442,6 +443,7 @@ class Walker {
}
array_splice( $children_elements, $i, 1 );
$num_elements--;
$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
$i = -1;
}