-1

I've the following array in PHP:

Array
(
    [CA] => Array
        [country] => Canada
        (
            [0] => Array
                (
                    [name] => BSB
                    [example] => 123456
                    [length] => 6 characters
                )

            [1] => Array
                (
                    [name] => Account Number
                    [example] => 12345678
                    [length] => 6 to 10 characters
                )

        )
)

How can I loop into this array without echoing the country name [country] => Canada ?

Actually, I have this:

foreach($array['CA'] as $key => $value) {
    ...
}

But the country name is printed.

Thanks.

Testy
  • 301
  • 2
  • 9

1 Answers1

0

Can we do like this,

foreach($array['CA']['country'] as $key => $value) {
    ...
}

instead,

foreach($array['CA'] as $key => $value) {
    ...
}
vimuth
  • 5,064
  • 33
  • 79
  • 116