Pchp.Library.Arrays.uasort C# (CSharp) Method

uasort() public static method

Sorts an array user comparison callback method for comparing values preserving key-value associations.
Resets array's intrinsic enumerator.
public static uasort ( Context ctx, [ array, IPhpCallable compare ) : bool
ctx Pchp.Core.Context Current runtime context.
array [ The array to be sorted.
compare IPhpCallable The user callback to be used for comparison of values.
return bool
        public static bool uasort(Context ctx /*, caller*/, [In, Out] PhpArray array, IPhpCallable compare)
        {
            if (array == null)
            {
                //PhpException.ReferenceNull("array");
                //return false;
                throw new ArgumentNullException();
            }
            if (!PhpVariable.IsValidCallback(compare)) return false;

            // sorts array using callback for comparisons:
            array.Sort(new ValueComparer(new PhpUserComparer(ctx, compare), false));

            return true;
        }