PHP array_product() Function6 Jan 2025 | 1 min read The array_product() function is inbuilt function of PHP. The array_product() function calculates the product of an array. This function was introduced in PHP 5.1.0. SyntaxParameters
Return TypeThe array_product() function returns the product as an integer or float. Example 1Output: 210 Example 2Output: Array ( [0] => 2 [1] => 6 ) 12 Array ( [0] => 7 [1] => 9 ) 63 Example 3Output: 39.6936144 Example 4Output: 1080 Next TopicPhp-array-push-function |
This function is used to flip the array with the keys and values. It takes one parameter that is an array. The returned array will contain the flipped elements. The values will be the keys, and the keys will be the values. This function was...
1 min read
PHP end() Function The end( ) function is an inbuilt function of PHP. The end() function Set the internal pointer of an array to its last element. This function was introduced in 4.0. Syntax mixed end ( array &$array ); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory Returns The end( ) function...
1 min read
PHP usort( ) Function The PHP usort( ) function is used to sort an array by its value using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. This function was...
2 min read
PHP sizeof() Function The sizeof( ) function is an alias of count( ) function. The sizeof( ) function returns the number of elements in an array. This function was introduced in PHP 4.0. Syntax intsizeof(array, mode); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory mode Specifies the mode. Possible values: 0 - Default. Does...
1 min read
The compact( ) function is an inbuilt function of PHP, and it is used to create an array from variables and their values. This function was introduced in PHP 4+. Syntax array compact ( mixed $varname1 [, mixed $... ] ); Parameters Parameter Description Is compulsory Variable1 It can be either a string...
1 min read
The array_diff_assoc() function is used to compare an array against another array and returns the difference. In other words, we can say that array_diff_assoc() function compares the keys and values of two or more arrays and return an array that contains the entries from array1...
1 min read
PHP natsort() Function The PHP natsort( ) function is used to sort an array using a "natural order" algorithm. The natsort( ) function implements a sort algorithm but maintains original keys and values. This function was introduced in PHP 4.0. Syntax bool natsort ( array &$array ); Parameter Parameter Description Is compulsory array Specifies...
2 min read
The array_key_first( ) function is used to get the first key of an array. This function was introduced in PHP 7.3.0 Syntax mixed array_key_first ( array $array ); Parameters Parameter Description Is compulsory array Specifies the array. compulsory Return Values The array_key_first( ) function returns the first key of the array if the array is not...
1 min read
PHP asort() Function The asort( ) function is an inbuilt function of PHP. The asort( ) function is used to sort an associative array in ascending order, according to the value. This function was introduced in PHP 4.0. Syntax bool asort ( array &$array [, int $sort_flags =...
1 min read
This is an inbuilt function of PHP. This function was introduced in PHP 5.1. The array_diff_key() function compares the keys of two or more arrays, and returns entries from array1 that are not present in array2 or array3, etc. Syntax array_diff_key(array1,array2,array3...); Parameter Description Is compulsory array1 The array to compare from compulsory array2 An array...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India