how to return certain data from an array by keys

前端 未结 1 871
既然无缘
既然无缘 2020-12-20 00:44

I was looking for a way of solving a problem of returning keys and data from an a array.

The keys are 7,8,9,10 and \"size\",\"atime\",\"mtime\",\"ctime\" from an arr

1条回答
  •  囚心锁ツ
    2020-12-20 01:00

    If I'm understanding your question correctly, it's as simple as this:

    array_intersect_key($array, array_flip(array('size', 'atime', ..)))
    

    http://php.net/array_intersect_key

    0 讨论(0)
提交回复
热议问题