Reputation: 70075
curl_version()
returns (among other things) a 24-bit version number as well as the version string. 24-bit version number 463623
corresponds to string version 7.19.7
.
Is there a simple algorithm for converting the 24-bit version to the string?
Upvotes: 0
Views: 311
Reputation: 197777
You mean this version number?
$v = curl_version();
echo $v['version']; # e.g. 7.15.5
It's easy to decipher:
$v = curl_version();
$n = $v['version_number'];
printf("%06x", $n); # e.g. 070f05
The version number is hex-decimal, 3 values, pick each one, convert to decimal:
07: 7
0f: 15
05: 5
See: http://curl.haxx.se/docs/versions.html
Upvotes: 1
Reputation: 58024
It could be something in this spirit:
printf("%d.%d.%d", $version >> 16, ($version >>8)&0xff, $version & 0xff);
Upvotes: 1