{
for (int i = 0; i < _arrays.length; i++) {
// reset direction/mode for each array (per the php.net spec)
int direction = SORT_ASC;
int mode = SORT_REGULAR;
ArrayValue av = (ArrayValue) _arrays[i];
// process all flags appearing *after* an array but before the next one
while ((i + 1) < _arrays.length
&& _arrays[i + 1] instanceof LongValue) {
i++;
int flag = _arrays[i].toInt();
switch (flag) {
case SORT_ASC:
direction = SORT_ASC;
break;
case SORT_DESC:
direction = SORT_DESC;
break;
case SORT_REGULAR:
mode = SORT_REGULAR;
break;
case SORT_STRING:
mode = SORT_STRING;
break;
case SORT_NUMERIC:
mode = SORT_NUMERIC;
break;
default:
_env.warning("Unknown sort flag: " + _arrays[i]);
}
}
int cmp;
Value lValue = av.get(_rows[index1.toInt()]);
Value rValue = av.get(_rows[index2.toInt()]);
if (mode == SORT_STRING) {
// php/173g
cmp = lValue.toString().compareTo(rValue.toString());
}