5

I have arrays like this.

Array ( 
[title] => Array ( [0] => Value1 ) 
[description] => Array ( [0] => Value1 )
) 

but i want the arrays to be look like this.

Array ( [title] => Value1 [description] => Value1 ) 

1 Answer 1

6

Simply

$array = array_map(function ($element) {
   return $element[0];
}, $array);

Test: http://3v4l.org/qd2eG

Sign up to request clarification or add additional context in comments.

1 Comment

Can you please explain a little how i can use it. I have arrays like this. $array_title = $class['title']; $array_desc = $class['description'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.