从Google Analytics Reporting API返回此数组。
Array ( [0] => Array ([0] => Downloads [1] => click [2] => Spring 2015 | 1001295 | NO CODE [3] => 1 [4] => 1),
[1] => Array ([0] => Downloads [1] => click [2] => Spring 2015 | 1001816 | [3] => 1 [4] => 1),
[2] => Array ([0] => Downloads [1] => click [2] => Spring 2015 | 1002500 | [3] => 1 [4] => 1),
[3] => Array ([0] => Downloads [1] => click [2] => Winter 2015 | 1004130 | [3] => 1 [4] => 1),
[4] => Array ([0] => Downloads [1] => click [2] => Winter 2015 | 1005166 | [3] => 1 [4] => 1),
[5] => Array ([0] => Downloads [1] => click [2] => Winter 2015 | 1009161 | [3] => 1 [4] => 1),
[6] => Array ([0] => Downloads [1] => click [2] => Winter 2015 | 1009480 | [3] => 1 [4] => 1),
[7] => Array ([0] => Downloads [1] => click [2] => Winter 2015 | 1009819 | NO CODE [3] => 1 [4] => 1),
[8] => Array ([0] => Downloads [1] => click [2] => Fall 2014 | 1009828 | [3] => 1 [4] => 1),
[9] => Array ([0] => Downloads [1] => click [2] => Fall 2014 | 1012443 | NO CODE [3] => 1 [4] => 1),
[10] => Array ([0] => Downloads [1] => click [2] => Fall 2014 | 1013870 | NO CODE [3] => 1 [4] => 1),
[11] => Array ([0] => Downloads [1] => click [2] => Fall 2014 | 1014200 | [3] => 1 [4] => 1),
[12] => Array ([0] => Downloads [1] => click [2] => Fall 2014 | 1014378 | [3] => 1 [4] => 1),
[13] => Array ([0] => Downloads [1] => click [2] => Fall 2014 | 1014408 | [3] => 1 [4] => 1),
[14] => Array ([0] => Downloads [1] => click [2] => Fall 2014 | 1014452 | [3] => 1 [4] => 1),
[15] => Array ([0] => Downloads [1] => click [2] => Fall 2014 | 1015367 | [3] => 1 [4] => 1),
[16] => Array ([0] => Downloads [1] => click [2] => Summer 2014 | 1015959 | [3] => 1 [4] => 1),
[17] => Array ([0] => Downloads [1] => click [2] => Summer 2014 | 1016689 | [3] => 1 [4] => 1),
[18] => Array ([0] => Downloads [1] => click [2] => Summer 2014 | 1017426 | NO CODE [3] => 1 [4] => 1),
[19] => Array ([0] => Downloads [1] => click [2] => Summer 2014 | 1021750 | [3] => 1 [4] => 1),
[20] => Array ([0] => Downloads [1] => click [2] => Summer 2014 | 1022956 | [3] => 1 [4] => 1),
[21] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1026419 [3] => 1 [4] => 1),
[22] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1026813 [3] => 1 [4] => 1),
[23] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1028789 [3] => 1 [4] => 1),
[24] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1029245 [3] => 1 [4] => 1),
[25] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1032008 [3] => 1 [4] => 1),
[26] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1033724 [3] => 1 [4] => 1),
[27] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1034546 [3] => 1 [4] => 1),
[28] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1035929 [3] => 1 [4] => 1),
[29] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1036488 [3] => 1 [4] => 1),
[30] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1038064 [3] => 1 [4] => 1),
[31] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1043900 [3] => 1 [4] => 1),
[32] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1044241 [3] => 1 [4] => 1),
[33] => Array ([0] => Downloads [1] => click [2] => spring_2015 | 1045560 [3] => 1 [4] => 1),
[34] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1045928 [3] => 1 [4] => 1),
[35] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1046329 [3] => 1 [4] => 1),
[36] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1046504 [3] => 1 [4] => 1),
[37] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1048908 [3] => 1 [4] => 1),
[38] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1051460 [3] => 1 [4] => 1),
[39] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1051466 [3] => 1 [4] => 1),
[40] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1052350 [3] => 1 [4] => 1),
[41] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1054942 [3] => 1 [4] => 1),
[42] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1056467 [3] => 1 [4] => 1),
[43] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1057099 [3] => 1 [4] => 1),
[44] => Array ([0] => Downloads [1] => click [2] => winter_2015 | 1057666 [3] => 1 [4] => 1)
)
我需要删除每个数组项的前2个成员。我该怎么做?
答案 0 :(得分:1)
这应该适合你:
只需使用array_map()
循环遍历数组的每个元素,然后返回偏移量为2的array_slice()
。
$newArray = array_map(function($v){
return array_slice($v, 2);
}, $oldArray);