I need to convert a multiple single values into an array, basically I managed to get names from the source as a string, but it's as the following:
All single strings:
DBG --> [string] date
DBG --> [string] conversion_time
DBG --> [string] conversion_ref
DBG --> [string] cookie_id
DBG --> [string] customer_id
DBG --> [string] browser
DBG --> [string] operating_system
DBG --> [string] site_search_string
DBG --> [string] page_url
DBG --> [string] store_viewed
DBG --> [string] store_search_string
DBG --> [string] product_id
DBG --> [string] category_id
DBG --> [string] basket_product_ids
I would like to convert it into an array so I can merge with another set of data to generate a file. The key of the array would be exactly the same as the value, so I'm looking to get it like this:
DBG --> [array] Array
(
[date] => date
[conversion_time] => conversion_time
[conversion_ref] => conversion_ref
[cookie_id] => cookie_id
[customer_id] => customer_id
[browser] => browser
[operating_system] => operating_system
[site_search_string] => site_search_string
[page_url] => page_url
[store_viewed] => store_viewed
[store_search_string] => store_search_string
[product_id] => product_id
[category_id] => category_id
[basket_product_ids] => basket_product_ids
)
How would I do that in PHP? I have been trying to convert string to array and repeat the value but it returns also as single ones: $array = array($names => $names);
DBG --> [array] Array
(
[date] => date
)
DBG --> [array] Array
(
[conversion_time] => conversion_time
)
DBG --> [array] Array
(
[conversion_ref] => conversion_ref
)
What do I need to do to get everything aligned?
I'm a bit of a newbie with coding.