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

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


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).


for multi layered array i use this:


function getIndexedArray($array) {        $arrayTemp = array();        for ($i=0; $i < count($array); $i++) {             $keys = array_keys($array[$i]);            $innerArrayTemp = array();            for ($j=0; $j < count($keys); $j++) {                 $innerArrayTemp[$j] = $array[$i][$keys[$j]];                            }            array_push($arrayTemp, $innerArrayTemp);        }        return $arrayTemp;    }

it turns this:

(    [0] => Array        (          [OEM] => SG            [MODEL] => Watch Active2            [TASK_ID] => 8            [DEPT_ASSIGNED] => Purchashing          ))

into this :

[0] => Array        (          [0] => SG            [1] => Watch Active2            [2] => 8            [3] => Purchashing          )