How to use array_filter() function in php ?

The array_filter() function use to filters the elements of an array using a callback function.

This function accepts two parameters and one flag. The first parameter is required which is to be an array, the second parameter is optional which is to be a callback function if passed and the last flag is also optional. The flags names are ARRAY_FILTER_USE_KEY and ARRAY_FILTER_USE_BOTH. By default array_filter() function uses ARRAY_FILTER_USE_KEY flag to filter the array. The flags were added in PHP version 5.6.0.

Continue reading How to use array_filter() function in php ?

What is usort() function in php & how to use it ?

The usort() function sort an array by values using a user-defined comparison function. It accepts two parameters, the first parameter must be an array to sort and the second parameter must be a string that defines a function. The function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. Note that before PHP 7.0.0 this integer had to be in the range from -2147483648 to 2147483647.

Continue reading What is usort() function in php & how to use it ?

array_push (arrName, varName) function in php

array_push() function use an array as a stack, and it pushes the passed variables at the end of the array. The length of the array increases automatically by the number of variables pushed into the array_push function. It accepts two parameters, the first parameter to be an array and the second parameter can be any type of value.

Continue reading array_push (arrName, varName) function in php