How to get array of values from an associative arrays?

前端 未结 4 1709
感情败类
感情败类 2020-12-19 07:51

How can I get an array of values from an associative array ?

Associate array Example:

Array
(
    [0] => Array
        (
            [0] => 1
          


        
4条回答
  •  再見小時候
    2020-12-19 08:37

    under php 5.3 this should be really nice and convenient, because the array elements used by array_reduce are interpreted as mixed rather than fixed as integer

    so

    print_r(array_reduce($test, 'array_merge'))
    

    I haven't tested it -- no copy of 5.3 -- at least in theory that should do it. Under <5.3 you'll get errors.

    Note that this only merges the top level of array, unlike the solution using array_walk_recursive.

提交回复
热议问题