Last active
November 27, 2019 10:39
-
-
Save nellytadi/77ca6fe33490f7198c4e9db80f769817 to your computer and use it in GitHub Desktop.
Merge two array and give them new keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function test(){ | |
$array =[0=> [ "organisation_name" => "HERTFORDSHIRE LIMITED", | |
"company_number" => "06124924", | |
"address" => " Schopwick Place, High Street, Elstree, Hertfordshire, England, WD6 3SW", | |
"company_status" => "active", | |
"company_type" => "ltd", | |
"date_of_incorporation" => "2007-02-23", | |
"nature_of_business" => "70100", | |
"town" => "Elstree"]]; | |
$array2=[1=>[ | |
"organisation_name" => "ACACIAS CONSULTING LTD", | |
"company_number" => "10715824", | |
"address" => " 2 Claridge Court, Lower Kings Road, Berkhamsted, United Kingdom, HP4 2AF", | |
"company_status" => "active", | |
"company_type" => "ltd", | |
"date_of_incorporation" => "2017-04-07", | |
"nature_of_business" => "70229", | |
"town" => "Berkhamsted" | |
]]; | |
$merge = array_merge($array,$array2); | |
dd($merge); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had to give them keys