Created
March 19, 2023 09:43
-
-
Save mikeott/e5c57f4f64b40e23676cd0d5564c19f5 to your computer and use it in GitHub Desktop.
PHP version compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (version_compare(PHP_VERSION, '6.0.0') >= 0) { | |
echo 'I am at least PHP version 6.0.0, my version: ' . PHP_VERSION . "\n"; | |
} | |
if (version_compare(PHP_VERSION, '5.3.0') >= 0) { | |
echo 'I am at least PHP version 5.3.0, my version: ' . PHP_VERSION . "\n"; | |
} | |
if (version_compare(PHP_VERSION, '5.0.0', '>=')) { | |
echo 'I am using PHP 5, my version: ' . PHP_VERSION . "\n"; | |
} | |
if (version_compare(PHP_VERSION, '5.0.0', '<')) { | |
echo 'I am using PHP 4, my version: ' . PHP_VERSION . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment