You are here

function _smarty_sort_length in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/lib/smarty/Smarty_Compiler.class.php \_smarty_sort_length()

compare to values by their string length

@access private

Parameters

string $a:

string $b:

Return value

0|-1|1

1 string reference to '_smarty_sort_length'
Smarty_Compiler::_compile_file in includes/moodle/lib/smarty/Smarty_Compiler.class.php
compile a resource

File

includes/moodle/lib/smarty/Smarty_Compiler.class.php, line 2289

Code

function _smarty_sort_length($a, $b) {
  if ($a == $b) {
    return 0;
  }
  if (strlen($a) == strlen($b)) {
    return $a > $b ? -1 : 1;
  }
  return strlen($a) > strlen($b) ? -1 : 1;
}