0

I have array results which is showing same index keys for the results in php. how to rebuild the array index keys starting from zero,one,and so on. please check with my below code and advise on this. I have tried to show like the below input like zero and one and so on... Please c heck with my below code

Code:

print '<pre>';
    print_r(array_values(array($svg_array_values)));

Array
(
    [0] => Array
        (
            [@attributes] => Array
                (
                    [id] => Layer_1
                    [data-name] => Layer 1
                    [viewBox] => 0 0 72 72
                    [width] => 234
                    [height] => 170
                    [preserveAspectRatio] => none
                )

            [defs] => Array
                (
                    [style] => .cls-1{fill-rule:evenodd;}
                )

            [title] => Arrow 20
            [path] => Array
                (
                    [@attributes] => Array
                        (
                            [class] => cls-1
                            [d] => M70.47,34.06,48.11,11.7a2.75,2.75,0,0,0-4.69,1.94l1.72,11.93h-34a10.43,10.43,0,0,0,0,20.86h34L43.42,58.37a2.76,2.76,0,0,0,2.75,2.74,2.77,2.77,0,0,0,1.94-.8L70.47,37.94a2.73,2.73,0,0,0,0-3.88Z
                            [fill] => #000000
                        )

                )

        )

)
Array
(
    [0] => Array
        (
            [@attributes] => Array
                (
                    [id] => Layer_1
                    [data-name] => Layer 1
                    [viewBox] => 0 0 72 72
                    [width] => 160
                    [height] => 99
                    [preserveAspectRatio] => none
                )

            [defs] => Array
                (
                    [style] => .cls-1{fill-rule:evenodd;}
                )

            [title] => Arrow 18
            [polygon] => Array
                (
                    [@attributes] => Array
                        (
                            [class] => cls-1
                            [points] => 71.28 36 55.49 20.21 55.49 31.19 0.72 31.19 0.72 40.81 55.49 40.81 55.49 51.79 71.28 36 71.28 36
                        )

                )

        )

)

my output should be like this

Array
(
    [0] => Array
        (
            [@attributes] => Array
                (
                    [id] => Layer_1
                    [data-name] => Layer 1
                    [viewBox] => 0 0 72 72
                    [width] => 234
                    [height] => 170
                    [preserveAspectRatio] => none
                )

            [defs] => Array
                (
                    [style] => .cls-1{fill-rule:evenodd;}
                )

            [title] => Arrow 20
            [path] => Array
                (
                    [@attributes] => Array
                        (
                            [class] => cls-1
                            [d] => M70.47,34.06,48.11,11.7a2.75,2.75,0,0,0-4.69,1.94l1.72,11.93h-34a10.43,10.43,0,0,0,0,20.86h34L43.42,58.37a2.76,2.76,0,0,0,2.75,2.74,2.77,2.77,0,0,0,1.94-.8L70.47,37.94a2.73,2.73,0,0,0,0-3.88Z
                            [fill] => #000000
                        )

                )

        )

)
Array
(
    [1] => Array
        (
            [@attributes] => Array
                (
                    [id] => Layer_1
                    [data-name] => Layer 1
                    [viewBox] => 0 0 72 72
                    [width] => 160
                    [height] => 99
                    [preserveAspectRatio] => none
                )

            [defs] => Array
                (
                    [style] => .cls-1{fill-rule:evenodd;}
                )

            [title] => Arrow 18
            [polygon] => Array
                (
                    [@attributes] => Array
                        (
                            [class] => cls-1
                            [points] => 71.28 36 55.49 20.21 55.49 31.19 0.72 31.19 0.72 40.81 55.49 40.81 55.49 51.79 71.28 36 71.28 36
                        )

                )

        )

)
gopi
  • 67
  • 10
  • `Duplicate Indexes === Not Possible` Those are 2 **seperate** arrays – RiggsFolly Dec 04 '17 at 15:27
  • what is the value of `$svg_array_values`? show us it's value. Also array_merge need to array, you provided one. It's not clear at all what is your question, what you are trying to achieve, and what inputs you have? – Alive to die - Anant Dec 04 '17 at 15:28

0 Answers0