PHP array_merge_recursive() FunctionLast Updated : 17 Mar 2025 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 |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India