Home > database >  Using PHP in need two array value in one array
Using PHP in need two array value in one array

Time:04-18

so the output is already shared formate. the final array should me array one value and array two value without any 0 and 1 index only the second array value need to add the same response


**// array one 
Array
(
    [success] => 1
    [message] => success
    [status_code] => 0
    [data] => Array
        (
            [email] => [email protected]
        )
    [http_response] => 200
)
// array two 
Array
(
    [success] => 1
    [message] => success
    [status_code] => 0
    [data] => Array
        (
            [name] => ram
        )
    [http_response] => 200
)
// output  needed like this  //
Array
(
    [success] => 1
    [message] => success
    [status_code] => 0
    [data] => Array
        (
            [email] => [email protected]
            [name] => ram
        )
    [http_response] => 200
)**



CodePudding user response:

You Can Simply Merge The Array And Re-Assign To Any Array

$array2['data'] = array_merge($array['data'],$array2['data']);
print_r($array2);
  • Related