PHP array_pad() Function

The array_pad() function is used to padding (insert) a specified number of elements, with a specified value, into an array. If the specified value is positive then the array is padded on the right, if it is negative then padded on the left. If the specified value is less than or equal to the length of the input then no padding takes place.array_pad() returns a copy of the array padded to size specified by size with value value. If size is positive then the array is padded on the right, if it's negative then on the left. If the absolute value of size is less than or equal to the length of the array then no padding takes place. It is possible to add at most 1048576 elements at a time.

Example -

Example -