How to define PHP_VERSION_ID and php_version_id

Source: Internet
Author: User

How to define PHP_VERSION_ID and php_version_id

PHP_VERSION_ID is an integer that indicates the current PHP version. It is used from php5.2.7, for example, 50207 indicates 5.2.7.
Macros related to the PHP version are defined in the phpsrcdir/main/php_version.h file, as follows:

// File Location: phpsrc/main/php_version.h/* automatically generated by configure * // * edit configure. in to change version number */# define PHP_MAJOR_VERSION 5 # define PHP_MINOR_VERSION 6 # define PHP_RELEASE_VERSION 24 # define PHP_EXTRA_VERSION "" # define PHP_VERSION "5.6.24" # define PHP_VERSION_ID 50624

As you can see from the annotations, the file phpsrcdir/main/php_version.h is generated after configure. The following is the relevant content under configure. in:

Dnl File Location: phpsrcdir/confiugre. in 117 # undef PTHREADS 118]) 119 120 PHP_MAJOR_VERSION = 5 121 PHP_MINOR_VERSION = 6 122 PHP_RELEASE_VERSION = 24 123 PHP_EXTRA_VERSION = "" 124 PHP_VERSION = "$ PHP_MAJOR_VERSION. $ PHP_MINOR_VERSION. $ PHP_RELEASE_VERSION $ PHP_EXTRA_VERSION "125 PHP_VERSION_ID = 'expr [$] PHP_MAJOR_VERSION \ * 10000 + [$] PHP_MINOR_VERSION \ * 100 + [$] PHP_RELEASE_VERSION '126 127 dnl Allow version To be used in Makefile 128 PHP_SUBST (PHP_MAJOR_VERSION) 129 PHP_SUBST (PHP_MINOR_VERSION) 130 PHP_SUBST (PHP_RELEASE_VERSION) 131 PHP_SUBST (PHP_EXTRA_VERSION )........ 139 dnl Setting up the PHP version based on the information above. 140 dnl ------------------------------------------------------------------------- 141 142 echo "/* automatically generated by configure */"> php_version.h.new 143 ech O "/* edit configure. in to change version number */"> php_version.h.new 144 echo" # define PHP_MAJOR_VERSION $ PHP_MAJOR_VERSION "> limit 145 echo" # define PHP_MINOR_VERSION $ PHP_MINOR_VERSION "> limit 146 echo" # define PHP_RELEASE_VERSION $ PHP_RELEASE_VERSION "> php_version.h.new 147 echo" # define PHP_EXTRA_VERSION \ "$ PHP_EXTRA_VERSION \" "> php_version.h.new 148 echo" # Define PHP_VERSION \ "$ PHP_VERSION \" "> php_version.h.new 149 echo" # define PHP_VERSION_ID $ PHP_VERSION_ID "> limit 150 cmp limit $ srcdir/main/php_version.h>/dev/null 2> & amp; 1 151 if test $? -Ne 0; then 152 rm-f $ srcdir/main/php_version.h & mv php_version.h.new $ srcdir/main/php_version.h & \ 153 echo 'updated main/php_version.h '154 else 155 rm-f limit 156 fi 157 158

From the above, we can see that the php version information is defined in configure. in,
120-125 rows
First, the main version PHP_MAJOR_VERSION, the sub-version PHP_MINOR_VERSION, the release version PHP_RELEASE_VERSION, and PHP_EXTRA_VERSION are defined as null;
PHP_VERSION is connected by the above version number with the symbol ".", which is our common version number, such as 5.6.24;
PHP_VERSION_ID is a 5-digit integer calculated by PHP_MAJOR_VERSION * 10000 + PHP_MINOR_VERSION * 100 + PHP_RELEASE_VERSION, such as 50624. PHP_VERSION_ID is often used in php kernel or extended source code.

Row 127-131
Submit to Makefile

Lines 139-156
Generate the file $ phpsrcdir/main/php_version.h

All constants defined by the php kernel: http://php.net/manual/en/reserved.constants.php

Article address: How is PHP_VERSION_ID defined?

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.