Add 2 values to 1 key in a PHP array

后端 未结 7 1017
面向向阳花
面向向阳花 2021-02-08 03:35

I have a result set of data that I want to write to an array in php. Here is my sample data:

**Name** **Abbrev**
Mike     M
Tom      T
Jim      J
相关标签:
7条回答
  • 2021-02-08 04:19

    You will need to create a two dimensional array to store more than one value.

    Each row in your result set is already an array, so it will need to be added to your variable as an array.

    array_push($values, array('name', 'abbreviation'));
    
    0 讨论(0)
提交回复
热议问题