Updated Answer

When visiting http://www.php.net/releases, I noticed that on the right panel, it says:

Want a PHP serialized list of the PHP releases?

Add ?serialize to the url
Only want PHP 5 releases? &version=5
The last 3? &max=3

Want a JSON list of the PHP releases?

Add ?json to the url
Only want PHP 5 releases? &version=5
The last 3? &max=3

So whether you'd rather use a PHP serialized version or JSON, you might use http://www.php.net/releases?serialize or http://www.php.net/releases?json

If you want to only see Version 5.x.x, you could use:

http://www.php.net/releases?json&version=5 (If you'd like to use JSON, otherwise replace json with serialize)

Original Answer (Critical, see Nannes comment)

Parsing the HTML structure is of course a bad idea, since the structure of the tags could change when a new homepage of php.net is introduced.

While searching for a solution, I came across this Atom feed: http://php.net/releases/feed.php

Since this is a Atom feed, the strucutre will not change, as it is defined by a standard 1]. You can then use PHP's default XML functions 2] to parse feed > entry:first-child > php:version (CSS-Syntax for demonstration purpose. :first-child is the first child selector, > the direct child selector) and then use PHP's version_compare 3].

More information:

  • 1] Atom standard (RFC 4287)
  • 2] PHP XML functions
  • 3] version_compare
Answer from CharlyDelta on Stack Overflow
🌐
PHP
php.net › downloads.php
PHP: Downloads
Development package (SDK to develop PHP extensions) 1.64MB sha256: fcdf8e906858cc211f176b260a41d66dad5ce3c40e7daa6d04703f4981bf6d30 ... Check the supported versions page for more information on the support lifetime of each version of PHP.
🌐
PHP.Watch
php.watch › versions
PHP Versions • PHP.Watch
PHP 8.5 is the latest PHP version, bringing major new syntax and features such as the Pipe operator syntax and the new URI extension.
🌐
AWS
docs.aws.amazon.com › aws elastic beanstalk › platforms › platform history › php platform history
PHP platform history - AWS Elastic Beanstalk
This page lists the current and ... PHP platform branches and the dates that each version was current. Previous platform versions remain accessible to accounts with active or terminated environments using them at the time they were superseded by a new version. See the Supported platforms page for information on the latest version of ...
🌐
Zend
zend.com › resources › php-versions
PHP Versions: Performance, Security, and Feature Comparisons | Zend
In this collection of resources, we look at the ongoing changes in PHP, how these changes are made, and track the evolution of the language to the most current PHP version.
🌐
PHP.Watch
php.watch › versions › 8.4 › releases
PHP 8.4 releases, Docker images, source code downloads, and Windows binary downloads
PHP 8.4 is an actively maintained branch, and will receive active bug fix and security updates until 2026-12-31 · Version Status · Supported · Latest Release · 8.4.19 · PHP 8.4 reaches End Of Life (EOL) 2028-12-31 · PHP 8.4 active support ends 2026-12-31 ·
🌐
CyberPanel Community
community.cyberpanel.net › support and discussion › general discussion
How do you update PHP to latest version (e.g. 7.4.21)? - General Discussion - CyberPanel Community
July 8, 2021 - Looked over the docs, and they only talk about switching between versions. But I would like to know how you can select or update to the latest version in CyberPanel? Thanks
Top answer
1 of 3
17

Updated Answer

When visiting http://www.php.net/releases, I noticed that on the right panel, it says:

Want a PHP serialized list of the PHP releases?

Add ?serialize to the url
Only want PHP 5 releases? &version=5
The last 3? &max=3

Want a JSON list of the PHP releases?

Add ?json to the url
Only want PHP 5 releases? &version=5
The last 3? &max=3

So whether you'd rather use a PHP serialized version or JSON, you might use http://www.php.net/releases?serialize or http://www.php.net/releases?json

If you want to only see Version 5.x.x, you could use:

http://www.php.net/releases?json&version=5 (If you'd like to use JSON, otherwise replace json with serialize)

Original Answer (Critical, see Nannes comment)

Parsing the HTML structure is of course a bad idea, since the structure of the tags could change when a new homepage of php.net is introduced.

While searching for a solution, I came across this Atom feed: http://php.net/releases/feed.php

Since this is a Atom feed, the strucutre will not change, as it is defined by a standard 1]. You can then use PHP's default XML functions 2] to parse feed > entry:first-child > php:version (CSS-Syntax for demonstration purpose. :first-child is the first child selector, > the direct child selector) and then use PHP's version_compare 3].

More information:

  • 1] Atom standard (RFC 4287)
  • 2] PHP XML functions
  • 3] version_compare
2 of 3
2
$data = @file_get_contents('https://www.php.net/releases/?json');
$data = @json_decode($data, true);
$data = current($data);
echo 'Latest version: ' . $data['version'];
Find elsewhere
🌐
Wikipedia
en.wikipedia.org › wiki › PHP
PHP - Wikipedia
2 days ago - PHP 5.1 and PHP 5.2 were released the following years, adding smaller improvements and new features, such as the PHP Data Objects (PDO) extension (which defines a lightweight and consistent interface for accessing databases) In 2008, PHP 5.x ...
🌐
Astra
wpastra.com › blog › guides and tutorials › wordpress php version: recommended php versions and upgrade guide
WordPress PHP Version: Which PHP Version to Use in 2026
July 3, 2024 - You’ll then be able to see the various versions of PHP that you can upgrade and downgrade from/to: In this instance we want our website to use the latest version of PHP which is PHP 7.4.2.
🌐
PHP
windows.php.net › download
PHP For Windows: Binaries and sources Releases
More recent versions of PHP are built with VS16 or VS17 (Visual Studio 2019 or 2022 compiler respectively) and include improvements in performance and stability.
🌐
PHP.Watch
php.watch
PHP.Watch: PHP Articles, News, Upcoming Changes, RFCs, and more
PHP 8.5 is the latest PHP version, bringing major new syntax and features such as the Pipe operator syntax and the new URI extension.
🌐
End of Life Date
endoflife.date › php
PHP | endoflife.date
1 week ago - The PHP Release Cycle was extended in March 2024 from 3 to 4 years: 2 years of bug fixes, and 2 years of security fixes.
🌐
PHP Releases
phpreleases.com
PHP Releases | Tighten
Takes string (ex: "7", "7.2", "7.2.12") and returns information for the major/minor/release level version requested. For specific releases (ex: 8.0.10), you will additionally receive PHP's latest_release number.