/ Published in: PHP

Easy check (:
**UPD**
You can just use [version_compare()](http://ca.php.net/manual/en/function.version-compare.php) function.
**UPD**
You can just use [version_compare()](http://ca.php.net/manual/en/function.version-compare.php) function.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function phpMinV($v) { $phpV = PHP_VERSION; if ($phpV[0] >= $v[0]) { return true; } elseif ($phpV[2] >= $v[2]) { return true; } } } return false; } /* ---- Newer than 4 ---- */ if (phpMinV('4')) { // ..... } // or if (phpMinV('4.*')) { // ..... } /* ---- Newer than 5.1 ---- */ if (phpMinV('5.1')) { // ..... } // or if (phpMinV('5.1.*')) { // ..... } /* ---- Newer than 5.2.3 ---- */ if (phpMinV('5.2.3')) { // ..... }
Comments
