AJLX Posted August 30, 2017 Share Posted August 30, 2017 Hi Guys, I have an array that looks like this: Array( => Array( => Header1 => Header2 => Header3 => Header4 => Header5 => Header6 => Header7) => Array( =>value1 =>Value2 =>Value3 => Value4 => Value5 => Value6 =>Value7) => Array( =>value1 =>Value2 =>Value3 => Value3 => Value4 => Value5 => Value6) It has come from a CSV file. Basically, I only need to use some of the columns, the rest can be unset/deleted. Is there a way that I can easily make an array that just has for example "header1" and "header5" and the corresponding values "value1" and "value5"? I don't know what order the columns are going to be in, so I need to somehow do it by name. I think I know the concept of what to do, I just lack the php knowledge to actually do it! I think I need to: Step 1:Loop through the array and get the array keys that match up to the headers above Step 2:reload through the array unsetting based on the array keys found in step 1 I've tried looking into array_intersect and array_diff but I can't work out how these would help. Thanks for reading! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.