/[cvs]/nfo/php/libs/org.netfrag.glib/utils/extensions.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/utils/extensions.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by joko, Wed Jun 25 23:41:14 2003 UTC revision 1.9 by jonen, Thu Aug 11 14:06:26 2005 UTC
# Line 13  Line 13 
13   * $Id$   * $Id$
14   *   *
15   * $Log$   * $Log$
16     * Revision 1.9  2005/08/11 14:06:26  jonen
17     * + added generic array-key sorting function
18     *
19     * Revision 1.8  2004/07/21 12:56:19  joko
20     * php5 compatibility
21     *
22   * Revision 1.7  2003/06/25 23:41:14  joko   * Revision 1.7  2003/06/25 23:41:14  joko
23   * now using "global $Dumper_mode"   * now using "global $Dumper_mode"
24   *   *
# Line 429  class php { Line 435  class php {
435    
436    // from: http://www.php.net/manual/en/function.method-exists.php    // from: http://www.php.net/manual/en/function.method-exists.php
437    function class_has_method($className, $methodName) {    function class_has_method($className, $methodName) {
438      $bool_exists = (in_array(strtolower($methodName), get_class_methods($className)));  
439        // new as of 2004-07-21: php5 compatibility
440        // taken from http://php.net/manual/en/function.version-compare.php
441        if (version_compare(phpversion(), "5.0.0", "<")) {
442          $methodName = strtolower($methodName);
443        }
444        
445        $bool_exists = (in_array($methodName, get_class_methods($className)));
446      return $bool_exists;      return $bool_exists;
447    }    }
448    
# Line 711  Bitte versuchen Sie es später nocheinmal Line 724  Bitte versuchen Sie es später nocheinmal
724    function even($var) {    function even($var) {
725        return ($var % 2 == 0);        return ($var % 2 == 0);
726    }    }
727      
728      // modified version from: http://de.php.net/manual/en/function.array-multisort.php
729      // compare values of two array-keys
730      // usage: asort($array, "comparar_caption");
731      function comparar_caption($a, $b, $key_name="caption") {
732           return strnatcasecmp($a[$key_name], $b[$key_name]);
733      }
734      
735    
736  }  }
737    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.9

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed