PHP array_merge_recursive() Function6 Jan 2025 | 2 min read The array_merge_recursive( ) function is a built-in function in PHP. This function is used to merge the elements or values of two or more arrays together into a single array, the values of one are appended to the end of the previous one. This function was introduced in PHP 4.0.1. SyntaxParameter
Return TypeAn array of values resulted from merging the arguments together. EXAMPLE 1Output: Array ( [a] => sachin [b] => Array ( [0] => virat [1] => ganguly ) [c] => yuvraj ) EXAMPLE 2Output: Array ( [a] => java [b] => T [z] => point [d] => tutorial ) EXAMPLE 3Output: Array ( [A] => Black [B] => Array ( [0] => Green [1] => Almond ) [C] => Yellow [D] => Array ( [0] => White [1] => Coconut ) [E] => Cyan [F] => Aero [H] => Blood [J] => Dark brown ) EXAMPLE 4Output: Array ( [a] => Array ( [0] => yuvraj [1] => sachin ) [b] => sachin [c] => rahul [d] => umesh [e] => ganguly ) Next TopicPhp-array-multisort-function |
The array_rand()function is a inbuilt function in PHP. The array_rand()function is used to fetch one or more random entries from an array. It uses a pseudo-random number generator that is not suitable for cryptographic purposes. This function was introduced in PHP 4.0. Syntax mixed array_rand ( array...
1 min read
The array_pop() function is inbuilt function of PHP. The array_pop() function is used to remove the last element of an array. For an empty array, this function returns NULL. This function was introduced in PHP 4.0. Syntax mixed array_pop ( array &$array ); Parameters Parameter Description Required/Optional array Specifies an array. compulsory Return Type The array_pop()...
1 min read
The array_intersect_key( ) function computes the intersection of arrays using keys for comparison. This function compares the keys of two or more arrays and returns the matches. This function compares the keys of two or more arrays and returns an array that contains the entries...
1 min read
The array_push() function is a inbuilt function in PHP. The array_push() function is used to add one or more elements onto the end of an array. The length of array increases by the number of variables pushed. The array_push() function was introduced in PHP 4.0. Syntax int...
1 min read
The array_uintersect_uassoc( ) is an inbuilt function of PHP. The array_uintersect_uassoc() function uses two user-defined functions to compare the keys and values of two or more arrays, and returns the matches. This function was introduced in PHP 5.0. Syntax array array_uintersect_uassoc ( array $array1 , array $array2...
1 min read
The array_udiff_assoc( ) function is an inbuilt function of PHP. The array_udiff_assoc( ) function use a built-in function to compare the keys and values of two or more arrays, and returns the differences. This function was introduced in PHP 5.0. Syntax array array_udiff_assoc ( array $array1 ,...
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. Syntax number array_product ( array $array ); Parameters Parameter Description Required/Optional array Specifies an array. compulsory Return Type The array_product() function returns the product as an integer or float. Example 1 <?php $prime=array(2,3,5,7); print_r(array_product($prime)); ?> Output: 210 Example 2 <?php $even=array(2,6); print_r($even); print_r(array_product($even)); echo "\n"; $odd=array(7,9); print_r($odd); print_r(array_product($odd)); ?> Output: Array ( ...
1 min read
The count( ) function is an inbuilt function of PHP, and it is used to count the elements of an array or the properties of an object. This function was introduced in PHP 4.0. Syntax int count ( mixed $array_or_countable [, int $mode = COUNT_NORMAL ] ); Parameters Parameter Description Is...
1 min read
PHP () Function The PHP ( ) function is used to fetch the array value in the ious place, pointed by the internal array pointer. This function was introduced in PHP 4.0. Syntax mixed ( array &$array ); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory Returns The ( ) function returns...
1 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
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