I've got two arrays. columns and tableInfo.
I want to merge them together, but when I try to do that with array_merge I get these results when I var_dump it:
array (size=67)
0 => string 'receive_date' (length=12)
1 => string 'day' (length=3)
2 => string 'main_category' (length=13)
3 => string 'brand' (length=5)
4 => string 'first_to_receive_qty' (length=20)
5 => string 'purchase_value' (length=14)
6 =>
array (size=6)
0 => string '2021-11-09' (length=10)
1 => string 'Tuesday' (length=7)
2 => string 'apparel' (length=7)
3 => string 'adidas' (length=6)
4 => string '3184' (length=4)
5 => string '34773.31' (length=8)
7 =>
array (size=6)
0 => string '2021-11-09' (length=10)
1 => string 'Tuesday' (length=7)
2 => string 'apparel' (length=7)
3 => string 'nike' (length=4)
4 => string '642' (length=3)
5 => string '5089.50' (length=7)
8 =>
array (size=6)
0 => string '2021-11-09' (length=10)
1 => string 'Tuesday' (length=7)
2 => string 'apparel' (length=7)
3 => string 'puma' (length=4)
4 => string '15' (length=2)
5 => string '120.00' (length=6)
but i want the array var_dump to look like:
array (size=726)
0 =>
array (size=6)
'receive_date' => string '2021-11-09' (length=10)
'day' => string 'tuesday' (length=7)
'main_category' => string 'apparel' (length=7)
'brand' => string 'adidas' (length=6)
'first_to_receive_qty' => string '3184' (length=4)
'purchase_value' => string '34773.31' (length=8)
1 =>
array (size=6)
'receive_date' => string '2021-11-09' (length=10)
'day' => string 'tuesday' (length=7)
'main_category' => string 'apparel' (length=7)
'brand' => string 'nike' (length=4)
'first_to_receive_qty' => string '642' (length=3)
'purchase_value' => string '5089.50' (length=7)
2 =>
array (size=6)
'receive_date' => string '2021-11-09' (length=10)
'day' => string 'tuesday' (length=7)
'main_category' => string 'apparel' (length=7)
'brand' => string 'puma' (length=4)
'first_to_receive_qty' => string '15' (length=2)
'purchase_value' => string '120.00' (length=6)
I've tried a couple of things but i just can't seem to figure out how I merge them into an array that looks like this. Can somebody tell me how I gotta do it?
My Answer:
array (size=2)_ 'column_name' => string 'id' (length=2)_ 'data_type' => string 'int' (length=3)_ 1 =_ array (size=2)_ 'column_name' => string 'name' (length=4)_ 'data_type' => string 'varchar' (length=7)_ 2 =_ array (size=2)_ 'column_name' => string 'age' (length=3)_ 'data_type' => string 'int' (length=3)_ 3 =_ array (size=2)_ 'column_name' => string 'email' (length=5)_ 'data_type' => string 'varchar' (length=7)_ 4 =_ array (size=2)_ 'column_name' => string 'address' (length=7)_ 'data_type' => string 'varchar' (length=7)_ 5 =_ array (size=2)_ 'column_name' => string 'phone' (length=5)_ 'data_type' => string 'varchar' (length=7)_ 6 =_ array (size=2)_ 'column_name' => string 'created_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 7 =_ array (size=2)_ 'column_name' => string 'updated_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 8 =_ array (size=2)_ 'column_name' => string 'deleted_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 9 =_ array (size=2)_ 'column_name' => string 'status' (length=6)_ 'data_type' => string 'tinyint' (length=7)_ 10 =_ array (size=2)_ 'column_name' => string 'role' (length=4)_ 'data_type' => string 'varchar' (length=7)_ 11 =_ array (size=2)_ 'column_name' => string 'password' (length=8)_ 'data_type' => string 'varchar' (length=7)_ 12 =_ array (size=2)_ 'column_name' => string 'remember_token' (length=14)_ 'data_type' => string 'varchar' (length=7)_ 13 =_ array (size=2)_ 'column_name' => string 'created_by' (length=10)_ 'data_type' => string 'int' (length=3)_ 14 =_ array (size=2)_ 'column_name' => string 'updated_by' (length=10)_ 'data_type' => string 'int' (length=3)_ 15 =_ array (size=2)_ 'column_name' => string 'deleted_by' (length=10)_ 'data_type' => string 'int' (length=3)_ 16 =_ array (size=2)_ 'column_name' => string 'role_id' (length=7)_ 'data_type' => string 'int' (length=3)_ 17 =_ array (size=2)_ 'column_name' => string 'user_id' (length=7)_ 'data_type' => string 'int' (length=3)_ 18 =_ array (size=2)_ 'column_name' => string 'product_id' (length=10)_ 'data_type' => string 'int' (length=3)_ 19 =_ array (size=2)_ 'column_name' => string 'quantity' (length=8)_ 'data_type' => string 'int' (length=3)_ 20 =_ array (size=2)_ 'column_name' => string 'price' (length=5)_ 'data_type' => string 'decimal' (length=7)_ 21 =_ array (size=2)_ 'column_name' => string 'total' (length=5)_ 'data_type' => string 'decimal' (length=7)_ 22 =_ array (size=2)_ 'column_name' => string 'order_id' (length=8)_ 'data_type' => string 'int' (length=3)_ 23 =_ array (size=2)_ 'column_name' => string 'customer_id' (length=11)_ 'data_type' => string 'int' (length=3)_ 24 =_ array (size=2)_ 'column_name' => string 'product_name' (length=12)_ 'data_type' => string 'varchar' (length=7)_ 25 =_ array (size=2)_ 'column_name' => string 'customer_name' (length=13)_ 'data_type' => string 'varchar' (length=7)_ 26 =_ array (size=2)_ 'column_name' => string 'order_date' (length=10)_ 'data_type' => string 'date' (length=4)_ 27 =_ array (size=2)_ 'column_name' => string 'order_status' (length=12)_ 'data_type' => string 'varchar' (length=7)_ 28 =_ array (size=2)_ 'column_name' => string 'customer_email' (length=14)_ 'data_type' => string 'varchar' (length=7)_ 29 =_ array (size=2)_ 'column_name' => string 'customer_phone' (length=14)_ 'data_type' => string 'varchar' (length=7)_ 30 =_ array (size=2)_ 'column_name' => string 'customer_address' (length=16)_ 'data_type' => string 'varchar' (length=7)_ 31 =_ array (size=2)_ 'column_name' => string 'customer_city' (length=13)_ 'data_type' => string 'varchar' (length=7)_ 32 =_ array (size=2)_ 'column_name' => string 'customer_state' (length=14)_ 'data_type' => string 'varchar' (length=7)_ 33 =_ array (size=2)_ 'column_name' => string 'customer_country' (length=16)_ 'data_type' => string 'varchar' (length=7)_ 34 =_ array (size=2)_ 'column_name' => string 'customer_zipcode' (length=16)_ 'data_type' => string 'varchar' (length=7)_ 35 =_ array (size=2)_ 'column_name' => string 'customer_notes' (length=14)_ 'data_type' => string 'text' (length=4)_ 36 =_ array (size=2)_ 'column_name' => string 'created_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 37 =_ array (size=2)_ 'column_name' => string 'updated_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 38 =_ array (size=2)_ 'column_name' => string 'deleted_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 39 =_ array (size=2)_ 'column_name' => string 'status' (length=6)_ 'data_type' => string 'tinyint' (length=7)_ 40 =_ array (size=2)_ 'column_name' => string 'created_by' (length=10)_ 'data_type' => string 'int' (length=3)_ 41 =_ array (size=2)_ 'column_name' => string 'updated_by' (length=10)_ 'data_type' => string 'int' (length=3)_ 42 =_ array (size=2)_ 'column_name' => string 'deleted_by' (length=10)_ 'data_type' => string 'int' (length=3)_ 43 =_ array (size=2)_ 'column_name' => string 'role_id' (length=7)_ 'data_type' => string 'int' (length=3)_ 44 =_ array (size=2)_ 'column_name' => string 'user_id' (length=7)_ 'data_type' => string 'int' (length=3)_ 45 =_ array (size=2)_ 'column_name' => string 'product_id' (length=10)_ 'data_type' => string 'int' (length=3)_ 46 =_ array (size=2)_ 'column_name' => string 'quantity' (length=8)_ 'data_type' => string 'int' (length=3)_ 47 =_ array (size=2)_ 'column_name' => string 'price' (length=5)_ 'data_type' => string 'decimal' (length=7)_ 48 =_ array (size=2)_ 'column_name' => string 'total' (length=5)_ 'data_type' => string 'decimal' (length=7)_ 49 =_ array (size=2)_ 'column_name' => string 'order_id' (length=8)_ 'data_type' => string 'int' (length=3)_ 50 =_ array (size=2)_ 'column_name' => string 'customer_id' (length=11)_ 'data_type' => string 'int' (length=3)_ 51 =_ array (size=2)_ 'column_name' => string 'product_name' (length=12)_ 'data_type' => string 'varchar' (length=7)_ 52 =_ array (size=2)_ 'column_name' => string 'customer_name' (length=13)_ 'data_type' => string 'varchar' (length=7)_ 53 =_ array (size=2)_ 'column_name' => string 'order_date' (length=10)_ 'data_type' => string 'date' (length=4)_ 54 =_ array (size=2)_ 'column_name' => string 'order_status' (length=12)_ 'data_type' => string 'varchar' (length=7)_ 55 =_ array (size=2)_ 'column_name' => string 'customer_email' (length=14)_ 'data_type' => string 'varchar' (length=7)_ 56 =_ array (size=2)_ 'column_name' => string 'customer_phone' (length=14)_ 'data_type' => string 'varchar' (length=7)_ 57 =_ array (size=2)_ 'column_name' => string 'customer_address' (length=16)_ 'data_type' => string 'varchar' (length=7)_ 58 =_ array (size=2)_ 'column_name' => string 'customer_city' (length=13)_ 'data_type' => string 'varchar' (length=7)_ 59 =_ array (size=2)_ 'column_name' => string 'customer_state' (length=14)_ 'data_type' => string 'varchar' (length=7)_ 60 =_ array (size=2)_ 'column_name' => string 'customer_country' (length=16)_ 'data_type' => string 'varchar' (length=7)_ 61 =_ array (size=2)_ 'column_name' => string 'customer_zipcode' (length=16)_ 'data_type' => string 'varchar' (length=7)_ 62 =_ array (size=2)_ 'column_name' => string 'customer_notes' (length=14)_ 'data_type' => string 'text' (length=4)_ 63 =_ array (size=2)_ 'column_name' => string 'created_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 64 =_ array (size=2)_ 'column_name' => string 'updated_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 65 =_ array (size=2)_ 'column_name' => string 'deleted_at' (length=10)_ 'data_type' => string 'timestamp' (length=9)_ 66 =_ array (size=2)_ 'column_name' => string 'status' (length=6)_ 'data_type' => string 'tinyint' (length=7)
Rate this post
4 of 5 based on 5172 votesComments