]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20334 re-fix - small performance improvement
authormudrd8mz <mudrd8mz>
Tue, 22 Sep 2009 21:18:29 +0000 (21:18 +0000)
committermudrd8mz <mudrd8mz>
Tue, 22 Sep 2009 21:18:29 +0000 (21:18 +0000)
As Petr suggested, is_array() is faster than empty() so it makes sense
to check it first.

lib/dml/moodle_database.php

index 8eb5891243b917b8d519f0ce939656a05960185e..50c453729a34a61724f27b4a37ec037f2a27eb30 100644 (file)
@@ -522,7 +522,7 @@ abstract class moodle_database {
      * @return array - $sql and $params
      */
     public function get_in_or_equal($items, $type=SQL_PARAMS_QM, $start='param0000', $equal=true) {
-        if (empty($items) and is_array($items)) {
+        if (is_array($items) and empty($items)) {
             throw new coding_exception('moodle_database::get_in_or_equal() does not accept empty arrays');
         }
         if ($type == SQL_PARAMS_QM) {