Make WordPress Core

Opened 6 years ago

Last modified 3 years ago

#46082 new enhancement

Why returning $menu_array[x] instead of $title

Reported by: subrataemfluence's profile subrataemfluence Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: dev-feedback 2nd-opinion
Focuses: Cc:

Description

File: wp-admin/includes/plugin.php
Function: get_admin_page_title()

In lines 1613, 1616, 1637, 1645 and 1660 the following pattern of assignments and return the value are used:

$title = $menu_array[x];
return $menu_array[x];

where $tile is global.

What is the difference between the following returning patterns

$title = $menu_array[x];
return $menu_array[x];

AND

$title = $menu_array[x];
return $title;

Since we are already updating the the global variable $title with that of $menu_array[x], why can't we just return $title instead of $menu_array[x]? For every single request global $title will receive a new value.

In line 1620 the return pattern is usual:

$title = $menu_array[0];
return $title;

Change History (1)

#1 @NomNom99
3 years ago

  • Keywords 2nd-opinion added
Note: See TracTickets for help on using tickets.