search associative array by value

后端 未结 7 2072
感动是毒
感动是毒 2020-12-09 15:40

I\'m fetching some JSON from flickrs API. My problem is that the exif data is in different order depending on the camera. So I can\'t hard-code an array number to get, for i

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 16:22

    $key = array_search('model', array_column($data, 'label'));
    

    In more recent versions of PHP, specifically PHP 5 >= 5.5.0, the function above will work.

提交回复
热议问题