PHP version judgment version_compare () function

 

mixed version_compare ( string $version1 , string $version2 [, string $operator ] )

string $ version1 - Version 1 Required

string $ version2 - Version 2 Required

string $ operator - understood as the operator it optional 

operator: <、lt、<=、 le、>、 gt、>=、 ge、==、 =、eq、 !=、<> 和 ne


The first time a version lower than the second version of return - . 1 
a first version of a time equal to the second version return  0 
when the first version is less than the second version of the return  . 1 




echo ' the PHP current version ' . . PHP_VERSION " \ n- " ; 
version_compare (PHP_VERSION, ' 5.2.0 ' ) 
version_compare (PHP_VERSION, ' 5.2.0 ' , ' = ' )

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11334606.html