Language and development rules: Difference between revisions

Jump to navigation Jump to search
Line 399: Line 399:
$version=preg_split('/[\.-]/',DOL_VERSION);
$version=preg_split('/[\.-]/',DOL_VERSION);
if (versioncompare($version,array(5,0,-4)) >= 0) { //mycode for 5.0 only; } // For dolibarr 5.0.* (the -4 means we include also alpha, beta, rc and rcX)
if (versioncompare($version,array(5,0,-4)) >= 0) { //mycode for 5.0 only; } // For dolibarr 5.0.* (the -4 means we include also alpha, beta, rc and rcX)
</source>
But this solution need to include the function versioncompare. An alternative solution is to do:
<source lang="php">
if ((float) DOL_VERSION >= 5.0) { //mycode for 5.0 only; } // For dolibarr 5.0.*
</source>
</source>


Navigation menu