Posted By

sjaak on 12/11/10


Tagged

constant bc


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

qubestream


PHP_VERSION_ID for versions < 50207


 / Published in: PHP
 

Works fine with version strings like "5.2.6-1+lenny8", also on PHP4 but it's not tested.

  1. <?php
  2. declare (encoding='utf8');
  3.  
  4.  
  5.  
  6. if (!defined ('PHP_VERSION_ID'))
  7. {
  8. $ver = array_map ('intval', explode ('.', PHP_VERSION, 3));
  9. $ver[0] *= 10000;
  10. $ver[1] *= 100;
  11. define ('PHP_VERSION_ID', array_sum ($ver));
  12. unset ($ver);
  13. }

Report this snippet  

You need to login to post a comment.