Using string functions to output integer PHP version _ PHP Tutorial

Source: Internet
Author: User
Use the string function to output the integer PHP version number. When using a program, you generally need to integer the php version to determine the output .? Php $ tempexplode (., phpversion (); get the version number $ numcount ($ tem) in the form of an array and then use the program. Generally, you need to integer the php version number 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;
?>

Bytes. ? Php $ temp = explode (., phpversion (); // Obtain the version number in array format $ num = count ($ tem...

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.