Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

array merge recursive function syntax tag tutorial 2013





Alert! Connect with 10,000 Chating Online. Join Now

Php array merge recursive () function

Write your php code

 
<?php ?>

Php Result


Your code below



(PHP 4 >= 4.0.1, PHP 5)

array_merge_recursive -- Merge two or more arrays recursively

Syntax

array array_merge_recursive ( array array1, array array2 [, array ...] )

array_merge_recursive() merges the elements of two or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array.

If the input arrays have the same string keys, then the values for these keys are merged together into an array, and this is done recursively, so that if one of the values is an array itself, the function will merge it with a corresponding entry in another array too. If, however, the arrays have the same numeric key, the later value will not overwrite the original value, but will be appended.

Example 1. array_merge_recursive() example

<?php
$ar1
= array("color" => array("favorite" => "red"), 5);
$ar2 = array(10, "color" => array("favorite" => "green", "blue"));
$result = array_merge_recursive($ar1, $ar2);
?>

The $result will be:

Array
(
    [color] => Array
        (
            [favorite] => Array
                (
                    [0] => red
                    [1] => green
                )

            [0] => blue
        )

    [0] => 5
    [1] => 10
)

See also array_merge().

Php array merge recursive Function syntax tag

array merge recursive php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php array merge recursive syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online