PHP Aligning Array Key Values

前端 未结 3 1099
春和景丽
春和景丽 2021-01-16 20:53

I\'ve Googled it for two days, and tried looking at the PHP manual, and I still can\'t remember that function that aligns the key values for PHP arrays.

All I\'m loo

3条回答
  •  Happy的楠姐
    2021-01-16 21:11

    function array_reset_index_keys($array)
    {
        $return = array();foreach($array as $k => $v){$return[] = $v;}return $return;
    }
    

    And then use like a regular function, should re index the array

    you can also use native functions such as array_values which returns the values of an array into a single dimension array, causing it to be re indexed .

提交回复
热议问题