[Solved] i want to echo the values from index 3 to 5 in an associative array, couldn’s figure it out,

If your array contains values in consecutive numeric order – array_slice would be the simplest approach: $result = array_slice($ar, 2, 3); print_r($result); The output: Array ( [C] => 3 [D] => 4 [E] => 5 ) ———- To print the result as key/value pairs: foreach (array_slice($ar, 2,3) as $k => $v) { echo “$k => … Read more

[Solved] Flattening of multidimensional table in PHP

Try this: function flatten_array($data) { $newArray = array(); foreach ($data as $key => $value) { if (is_array($value)) { $newArray[] = ‘Start’ . $key; $newArray = array_merge($newArray,flatten_array($value)); $newArray[] = ‘End’ . $key; } else { $newArray[$key] = $value; } } return $newArray; } $flat = flatten_array($data); print_r($flat); output: Array ( [one] => one [0] => Starttwo … Read more

[Solved] AngularJS Json Array

response is an object. result is an object. full is an object. Array1 and Array2 are, obviously enough, arrays. For mytext1: response.result.full.Array1[0] For mytext2: response.result.full.Array1[1] For mytext3: response.result.full.Array2[0] For mytext4: response.result.full.Array2[1] If you want to log everything in the array, use a simple for…loop: var arr = response.result.full.Array1; for (var i = 0, l = … Read more