Link to home
Start Free TrialLog in
Avatar of Tony Rhoades
Tony Rhoades

asked on

How do I add Key=>Value pairs, based on a variable number of Keys, to the 2nd Dimension of an existing 2D Array in PHP?

I need to add additional Key=>Value pairs, based on a variable number of Keys, to and existing 2D Array in PHP.

I have spent days on this and very much need a solution.

As you can see there are 19557 Arrays in the second dimension.

I need it add Key=>Value pairs begging at index '5' up to a variable number.

Here is the structure of the array.

array(19557) { 
	[0]=> array(5) { 
		[0]=> string(6) "160478" 
		[1]=> string(21) "2019-01-01-2019-01-15" 
		[2]=> string(2) "90" 
		[3]=> string(5) "10217" 
		[4]=> string(4) "ESPC" 
	} 
	
	[1]=> array(5) { 
		[0]=> string(6) "160478" 
		[1]=> string(21) "2019-01-01-2019-01-15" 
		[2]=> string(2) "90" 
		[3]=> string(5) "10217" 
		[4]=> string(3) "PIP" 
	} 
	
	[2]=> array(5) { 
		[0]=> string(6) "160479" 
		[1]=> string(21) "2019-01-01-2019-01-15" 
		[2]=> string(2) "90" 
		[3]=> string(5) "10360" 
		[4]=> string(5) "FDNSC" 
	}
	...
}

Open in new window


Can anyone help?

It would be greatly appreciated.
Avatar of Terry Woods
Terry Woods
Flag of New Zealand image

To make it clear, can you provide a mock up of how you'd like the array to look?
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tony Rhoades
Tony Rhoades

ASKER

Norie,

Thank you this worked perfectly.