The "array_fill" Function


array_fill(id, [value]);
idarrayThe index of a previously-created array to modify
[value]anyOptional: Sets a value to assign to all new cells (default 0)


Finds the longest dimension of a multidimensional array and fills all other dimensions to match the same length, optionally assigning a default value to any new cells created. If a custom value is not specified, 0 will be used by default.

Can be useful for parsing arrays where the parser must assume a certain size for all dimensions of an array. However, note that this function fills array length only. Sub-dimensions can still be non-uniform in depth, which cannot be solved by this function, as doing so would result in data loss.


array_fill(my_array, -1);