【发布时间】:2017-03-10 05:23:36
【问题描述】:
所以我正在努力从重力形式表单中收集大量数据,该表单将值存储在名为 $entry[] 的数组中。
我需要从 $entry[14] 到 $entry[30] 或其他类似的地方收集所有值。有没有办法只为数组的那些选定部分执行 foreach 循环或其他操作?
我目前的解决方案相当重复。
$valuesArray = array($entry["14"], $entry["15"], $entry["16"], $entry["17"], $entry["18"], $entry["19"]);
$entry 的变量转储给出以下结果
array(30) {
["id"]=> string(2) "48"
["form_id"]=> string(1) "1"
["date_created"]=> string(19) "2016-10-27 13:30:24"
["is_starred"]=> int(0)
["is_read"]=> int(0)
["ip"]=> string(13) "..."
["source_url"]=> string(26) "http://examplesite.com/"
["post_id"]=> NULL
["currency"]=> string(3) "DKK"
["payment_status"]=> NULL
["payment_date"]=> NULL
["transaction_id"]=> NULL
["payment_amount"]=> NULL
["payment_method"]=> NULL
["is_fulfilled"]=> NULL
["created_by"]=> string(1) "1"
["transaction_type"]=> NULL
["user_agent"]=> string(82) ""
["status"]=> string(6) "active"
[9]=> string(14) "Jeg er en mand"
[10]=> string(9) "50-54 år"
[11]=> string(9) "Kommune 3"
[16]=> string(1) "3"
[15]=> string(1) "0"
[6]=> string(0) ""
[1]=> string(0) ""
[8]=> string(0) ""
[12]=> string(0) ""
[2]=> string(0) ""
[5]=> string(0) "" }
【问题讨论】:
标签: php arrays wordpress gravity-forms-plugin