PHP array_reduce() is an inbuilt function that sends the values in the array to a user-defined function and returns a string. The array_reduce() function is used to reduce the items of an array into the single value that can be of a float, an integer or a string value. If an array is empty and the initial is not passed, this function returns NULL.

PHP Array Reduce Example

PHP array_reduce() method iteratively reduce the array to a single value using a callback function. See the below syntax.

array_reduce(array, myfunction, initial)

An array parameter is required, and it specifies an array.

The myfunction is required, and it specifies the name of the function.

An initial parameter is required, and it specifies the initial value that needs to send the function.

#php #php array reduce

PHP Array Reduce Example | PHP array_reduce() Function Tutorial
2.40 GEEK