Convert array into simple 1 level array in PHP

后端 未结 4 748
遇见更好的自我
遇见更好的自我 2021-01-14 20:16

A simple thing to do, but I forgot how to convert

Array
(
    [0] => Array
        (
            [hashcode] => 952316176c1266c7ef1674e790375419
                


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-01-14 20:59

    I know this is premature but since this is coming soon I figured I throw this out there. As of (the not yet released) PHP 5.5 you can use array_column():

     $hashcodes = array_column($array, 'hashcode');
    

提交回复
热议问题