0; $i++ ) { $majors[] = $x . '.' . $y; if ( 0 === $y ) { --$x; $y = 9; } else { --$y; } } return $majors; } /** * Picks the newest of the installed version and the version WordPress offers as update. * * @param string $installed Installed WordPress version. * @param object|false|null $update_core Value of the update_core site transient. * @return string */ public static function latest_known( string $installed, $update_core ): string { $latest = $installed; if ( is_object( $update_core ) && ! empty( $update_core->updates ) && is_array( $update_core->updates ) ) { foreach ( $update_core->updates as $offer ) { if ( is_object( $offer ) && ! empty( $offer->current ) && version_compare( (string) $offer->current, $latest, '>' ) ) { $latest = (string) $offer->current; } } } return $latest; } }