[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/libs/artichow/php4/ -> common.php (source)

   1  <?php
   2  /*
   3   * This work is hereby released into the Public Domain.
   4   * To view a copy of the public domain dedication,
   5   * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
   6   * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
   7   *
   8   */
   9  
  10  /*
  11   * Get the minimum of an array and ignore non numeric values
  12   */
  13  function array_min($array) {
  14  
  15      if(is_array($array) and count($array) > 0) {
  16      
  17          do {
  18              $min = array_pop($array);
  19              if(is_numeric($min === FALSE)) {
  20                  $min = NULL;
  21              }
  22          } while(count($array) > 0 and $min === NULL);
  23          
  24          if($min !== NULL) {
  25              $min = (float)$min;
  26          }
  27          
  28          foreach($array as $value) {
  29              if(is_numeric($value) and (float)$value < $min) {
  30                  $min = (float)$value;
  31              }
  32          }
  33          
  34          return $min;
  35      
  36      }
  37      
  38      return NULL;
  39  
  40  }
  41  
  42  /*
  43   * Get the maximum of an array and ignore non numeric values
  44   */
  45  function array_max($array) {
  46  
  47      if(is_array($array) and count($array) > 0) {
  48      
  49          do {
  50              $max = array_pop($array);
  51              if(is_numeric($max === FALSE)) {
  52                  $max = NULL;
  53              }
  54          } while(count($array) > 0 and $max === NULL);
  55          
  56          if($max !== NULL) {
  57              $max = (float)$max;
  58          }
  59          
  60          foreach($array as $value) {
  61              if(is_numeric($value) and (float)$value > $max) {
  62                  $max = (float)$value;
  63              }
  64          }
  65          
  66          return $max;
  67      
  68      }
  69      
  70      return NULL;
  71  
  72  }
  73  
  74  /*
  75   * Register a class with the prefix in configuration file
  76   */
  77  function registerClass($class, $abstract = FALSE) {
  78  
  79      if(ARTICHOW_PREFIX === 'aw') {
  80          return;
  81      }
  82      
  83      
  84      $abstract = '';
  85      
  86  
  87      eval($abstract." class ".ARTICHOW_PREFIX.$class." extends aw".$class." { }");
  88  
  89  }
  90  
  91  /*
  92   * Register an interface with the prefix in configuration file
  93   */
  94  function registerInterface($interface) {
  95  
  96      if(ARTICHOW_PREFIX === 'aw') {
  97          return;
  98      }
  99  
 100  
 101  }
 102  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics