Home >Backend Development >PHP Tutorial >How to output integer version number in PHP
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.