added limit parameter to array_cmp()