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 |
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_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_replace() function is a built-in function in PHP. The PHP array_replace( ) function is used to replace the values of the first array with the values from following arrays. This function was introduced in PHP 5.3.0. Syntax array array_replace ( array $array1 [, array $... ]...
1 min read
PHP list() Function The PHP list( ) function is used to assign values to a list of variables in one operation. This function was introduced in PHP 4.0. Syntax array list ( mixed $var1 [, mixed $... ] ); Parameter Parameter Description Is compulsory Variable1 The first variable to assign a value to. compulsory Variable2... More variables...
1 min read
The array_uintersect_assoc( ) function is an inbuilt function of PHP. The array_uintesect_assoc() function compares two or more arrays, and then returns an array containing the elements from the first array. This function was introduced in PHP 5.0. Syntax array array_uintersect_assoc ( array $array1 , array $array2 [,...
1 min read
The array_map( ) is an built-in function in PHP. The array_map( ) function sends each value of an array to a user-defined function, and returns an array with new values given by the user-defined function. This function was introduced in 4.0.6. Syntax array array_map ( callable $callback...
1 min read
PHP array_fill( ) Function The array_fill( ) function is used to fill an array with values. This function creates a user-defined array with a given pre-filled value. It was introduced in PHP 4. Syntax array array_fill ( int $start_index , int $num , mixed $value ) Parameter Parameter Description Is compulsory starting_index The first...
1 min read
The array_reverse() function is a inbuilt function of PHP. The array_reverse( ) function is used to reverse the order of the elements in an array. This function was introduced in PHP 4.0. Syntax array array_reverse ( array $array [, bool $preserve_keys = FALSE ] ); Parameter Parameter Description Is compulsory array Specifies an...
1 min read
PHP natcasesort() Function The natcasesort( ) function is used to sort an array using a case insensitive "natural array" algorithm. The function implements a sort algorithm but maintains original keys and values. This function was introduced in PHP 4.0. Syntax bool natcasesort ( array &$array ); Parameter Parameter Description Is compulsory array The input...
2 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
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