Change an associative array into an indexed array / get an Zend_Table_Row_Abstract as non-associative

后端 未结 4 1391
无人及你
无人及你 2021-02-03 17:19

Hi out there in Stackland. I was wondering if there was either a function or an easy way to change an associative array into an indexed array.

To elaborate, I\'m using

4条回答
  •  孤街浪徒
    2021-02-03 17:48

    define function

    function array_default_key($array) {
        $arrayTemp = array();
        $i = 0;
        foreach ($array as $key => $val) {
            $arrayTemp[$i] = $val;
            $i++;
        }
        return $arrayTemp;
    }
    

    Pass the associative array as a parameter and it will convert into the default index of the array. For example: we have Array('2014-04-30'=>43,'2014-04-29'=>41) after the call to the function the array will be Array(0=>43,1=>41).

提交回复
热议问题