我有一个名为$matches
下面的数组,你可以看到一个
的结果 print_r(array_filter($matches));
Array (
[0] => Array (
[0] => Age:
[1] => 22 Years
[2] => Ethnicity:
[3] => Caucasian
[4] => Location:
[5] => London, United Kingdom
和结果 var_dump($matches);
array(1) {
[0]=> array(66) {
[0]=> string(202) " Age: "
[1]=> string(157) " 22 Years "
[2]=> string(196) " Ethnicity: "
[3]=> string(146) " Caucasian "
[4]=> string(195) " Location: "
[5]=> string(175) " London, United Kingdom "
所以这里的结构是 Key -> Value, Key -> Value,..
正如您注意到的所有键(值名称)都以:
我想要的结果:
echo $age; // Should result: 22 Years
echo $ethnicity; // Should result: Caucasian
echo $location; // Should result: London, United Kingdom
如何将数组编号 0、2、4 作为值名称?
并且热设置数组编号 1,2,5 作为他们的结果?