= 0; $wpSupported = version_compare($wp_version, $sdk['wp']) >= 0; return $phpSupported && $wpSupported; })); // Sort SDK by version in descending order uasort($supported, function ($x, $y) { return version_compare($y['sdk'], $x['sdk']); }); // Reset sorted values keys $supported = array_values($supported); if (!isset($supported[0])) { throw new Exception('There is no SDK which is support current PHP version and WP version'); } // Autoload files for supported SDK $autoloaderPath = str_replace( '\\', '/', sprintf('%s/autoload.php', $supported[0]['path']) ); require_once $autoloaderPath; $loaded = true; } }