I have an array that looks like:

我有一个看起来像这样的数组:

Array ( [0] => Array ( [0] => enrolment_id [1] => 0123) 
[1] => Array ( [0] => child_first [1] => Kate ) 
[2] => Array ( [0] => child_last [1] => Limmage ) 
[3] => Array ( [0] => child_preferred [1] => )... )

etc... all the way to [159]. It comes from $_POST data.

等等......一直到[159]。它来自$ _POST数据。

How do I get this to look like

我该如何看待它

'enrolment_id' => '0123',
'child_first' => 'Kate',
'child_last' => 'Limmage',

so that I can use it in the from $wpdb->insert( $table, $data, $format );

所以我可以在$ wpdb-> insert($ table,$ data,$ format)中使用它;

1 个解决方案

#1


1

The easiest way:

最简单的方法:

$result = array();
foreach ($_POST as $v) {
   $result[$v[0]] = $v[1];
}

更多相关文章

  1. 如何在php中为json数组创建搜索功能
  2. PHP数组值进入第二个数组[重复]
  3. 如何在php数组中插入新的键值对?
  4. mysql_fetch_array返回一个数组,数字为“1”
  5. PHP-从多维数组中删除重复值
  6. 更改数组键而不更改顺序
  7. 在PHP中更改关联数组索引的位置
  8. 如何在数组中存储产品数量
  9. php吧字符串直接转换成数组处理

随机推荐

  1. Vue生命周期钩子简介[每日前端夜话0x8A]
  2. 链路追踪 SkyWalking 源码分析 —— Agen
  3. Azure DevTest Lab体验(一)简介及部署
  4. 我是如何拿到蚂蚁金服 offer ?
  5. Java 8 日期/时间 API
  6. 链路追踪 SkyWalking 源码分析 —— Coll
  7. 分布式链路追踪 SkyWalking 源码分析 —
  8. android 视频播放---------利用android原
  9. 影响RPA云部署总持成本的7大因素
  10. shell脚本之灵活调用函数技巧