Use the string function to output the integer PHP version number.
Source: Internet
Author: User
Use a string function to output an integer PHP version number. Read the PHP version number that uses a string function to output an integer. when using a program, you generally need to evaluate the php version number after the integer is used, to determine the output .? Php $ temp = explode (., phpversion (); // Obtain the version number in the form of an array $ num = count ($ temp); & n... "> <when LINKhr is used in a program, you generally need to integer the php version to determine the output.
$ Temp = explode (".", phpversion (); // Obtain the version number as an array
$ Num = count ($ temp); // calculates 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 content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service