Home  >  Article  >  Backend Development  >  Use string function to output integer PHP version number_PHP tutorial

Use string function to output integer PHP version number_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:03:201062browse

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 the form of an array
$num=count($temp); 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;
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316302.htmlTechArticleWhen reusing the program, you generally need to integer the PHP version number to determine the output. ?php $temp=explode(.,phpversion()); //Get the version number in array form $num=count($tem...
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