Home >Backend Development >PHP Tutorial >How to output integer version number in PHP

How to output integer version number in PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-08 09:33:531392browse

When reusing the program, it is generally necessary to integer the PHP version number to determine the output.

$temp=explode(".",phpversion()); //Get the version number in array form
$num=count($temp);                                     // Calculate the number of elements in the array
$phpver=0;
switch($num)
{
cas 3:
$phpver=$phpver+(intval($temp[2]));
cas 2:
$phpver=$phpver+(intval($temp[1]*10);
cas 1:
$phpver=$phpver+(intval($temp[0]*100);
default:
}
echo $phpver;
?>

The above introduces how PHP outputs the integer version number, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn