0

I am trying to separate an array from a nested array.Any help would be appreciated.

Nested array:

array:1 [▼
  "empid" => array:2 [▼
    0 => "IDE023"
    1 => "IDE025"
  ]
]

I want to split the below array from that

array:2 [▼
  0 => "IDE023"
  1 => "IDE025"
]

How can i do that using PHP ?

2
  • $new_array = $original_array[1]['empid"']; Commented Sep 23, 2016 at 7:16
  • Seriously, it should not be that simple. What's the catch? Commented Sep 23, 2016 at 7:25

2 Answers 2

1

Use array_pop

$yourArray = array_pop($yourArray);

Note this will disturb the original array. Use only if don't want to use the original array again.

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

Comments

0
$split_array = $original_array['empid'];

Comments

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.