Skip to content
Advertisement

Array into array using array_push key issue

I’m getting confused about how to insert array into array and give it a key name. Not number!.

I have the main array, which contains info about customer. the sub array should be called [“verlauf”].

The [“verlauf”] array conatins multiple arrays ( as same as db row count ). the main idea is that the sub array should be having the key name [“verlauf”]. in my code im getting the [0] as key.

Current array output:

JavaScript

what i want is that the [0] on line 6 in the above example to be ["verlauf"]

My PHP:

JavaScript

Please note that $returnArray is the “main array”.

Advertisement

Answer

You can simply do that by using associate array-

Your PHP code –

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement