-4

My code looks like:

Array ( [0] => Array ( [uid] => 3456345345 [name] = test))

What to do to look like this:

Array ( [uid] => 3456345345 [name] = test)
Chris
  • 1,692
  • 11
  • 15
  • 1
    Please post your array exactly. – TBI Jul 18 '14 at 09:27
  • depends on what you want to do with it? `$array[0]` would do the trick, or if you don't know the initial index, `reset($array)` will also return the first value. You really need to be a bit more specific in your question. – Blizz Jul 18 '14 at 09:28
  • The value you want is already part of the value you have. There is no need to transform anything, just "unwrap" the first element with `$array[0]`. – Jon Jul 18 '14 at 09:28

1 Answers1

-1
<?php

function arrayflatten($array)
{
    if(!is_array($array))
        return false;
    $result=array();
    foreach($array as $key=>$value)
    {
        if(is_array($value))
        $result=array_merge($result,arrayflatten($value));
    else 
        $result[$key]=$value;
    }
    print_r ($result);
}



$a=array(array( "Volvo","22"));
arrayflatten($a);
?>
buvan
  • 1
  • 1