From: mudrd8mz Date: Tue, 22 Sep 2009 21:18:29 +0000 (+0000) Subject: MDL-20334 re-fix - small performance improvement X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=44f6ca9e11a8c4e8540cbde03d8e63aaa8bff15d;p=moodle.git MDL-20334 re-fix - small performance improvement As Petr suggested, is_array() is faster than empty() so it makes sense to check it first. --- diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index 8eb5891243..50c453729a 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -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) {