Skip to content

PHP – array_push to create a multidimensional array

I am trying to create an array which will have two key/value pairs for each user. I would like to add their user ID as well as their name. Currently I have this: This gives me the following: However, to make it easier to read and work with, I would prefer that it shows user_id and user_name as the keys,

remapping and grouping repeated values from an array in php

I am trying to remap an response from a query to the database and group like items in one array. for example, from this example below. Response: looping through results: This doesnt really give me what i need as I am trying to group the array based on Location and add the AppDate base on that location. Someth…