/ Published in: PHP
Easy check (:
UPD You can just use version_compare() function.
Expand |
Embed | Plain Text
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')) { // ..... }
You need to login to post a comment.
