WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/19/2015 03:55:39 AM (6 years ago)
Author:
wonderboymusic
Message:

Replace array_shift() with reset() where appropriate for performance.

Props SergeyBiryukov.
Fixes #31259.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/menu.php

    r31300 r31829  
    9595        continue;
    9696    $subs = $submenu[$data[2]];
    97     $first_sub = array_shift($subs);
     97    $first_sub = reset( $subs );
    9898    $old_parent = $data[2];
    9999    $new_parent = $first_sub[2];
     
    164164    if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) {
    165165        $subs = $submenu[$data[2]];
    166         $first_sub = array_shift($subs);
     166        $first_sub = reset( $subs );
    167167        if ( $data[2] == $first_sub[2] )
    168168            unset( $submenu[$data[2]] );
Note: See TracChangeset for help on using the changeset viewer.