Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove parent array from multidimensional array in php

Tags:

php

using php how to get array result into below way,

 Array
    (
        [3] => Array
            (
                [15] => 15
                [16] => 16
                [17] => 17
                [18] => 18
                [19] => 19
            )

    )

how to convert above array into below format,

 Array
        (
            [0] => 15
            [1] => 16
            [2] => 17
            [3] => 18
            [4] => 19
        )
like image 921
Rakesh Jesadiya Avatar asked Dec 18 '22 07:12

Rakesh Jesadiya


1 Answers

array_values() is your friend;

Presuming your array exists in a variable called $array;

$newArray = array_values($array[3]);
like image 59
Tom Avatar answered Jan 11 '23 18:01

Tom