Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,950 questions

51,892 answers

573 users

How to compares two PHP-standardized version number strings using version_compare() in PHP

2 Answers

0 votes
if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
    echo 'PHP 8.0.0 or later, my version is: ' . PHP_VERSION;
}
   
   
    
   
/*
run: 
   
PHP 8.0.0 or later, my version is: 8.0.13
   
*/

 



answered Jul 23, 2016 by avibootz
edited Jul 8, 2023 by avibootz
0 votes
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
    echo 'PHP 8.0.0 or later' . "\n";
} else {
     echo 'PHP version is not less than 8.0.0' . "\n";
}

echo 'My PHP version is: ' . PHP_VERSION;
   
   
    
   
/*
run: 
   
PHP version is not less than 8.0.0
My PHP version is: 8.0.13
   
*/

 



answered Jul 8, 2023 by avibootz
...