Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
url for downloading a PHP 5 version release - for using with
* returns url for downloading a PHP 5 version release
* Check if the release is on, otherwise, use distributions url
* @param string $version format X.Y.Z
* @return string url
function urlRelease($version)
$urlDistribution = '{version}.tar.bz2';
$urlMuseum = '{version}.tar.bz2';
$urlApiReleases = '';
$listReleases = unserialize(file_get_contents($urlApiReleases));
if (isset($listReleases[$version]['museum'])) {
return str_replace('{version}', $version, $urlMuseum);
return str_replace('{version}', $version, $urlDistribution);
$releases = [
foreach ($releases as $version) {
printf('Version: %s - Url: %s <br>', $version, urlRelease($version));
Release out of museum
<?php echo urlRelease('5.5.9'); ?>
Release in museum
<?php echo urlRelease('5.4.0'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.