P
P
profseo20122016-07-02 18:04:03
PHP
profseo2012, 2016-07-02 18:04:03

PHP array processing help?

Good afternoon!
Need help with array processing.
There is an array

[0]=>
  array(19) {
    ["Descr1"]=>
    string(82) "2222"
    ["Desc"]=>
    string(76) "9999"
    ["Phone1"]=>
    string(13) "0-800-000-000"
    ["Type"]=>
    string(36) "545353535"
    ["Rename"]=>
    string(36) "121223242"
    ["City"]=>
    string(12) "Город"
    ["City4"]=>
    string(10) "Страна"
    ["POSTerminal"]=>
    string(1) "1"
    ["Reception"]=>
    array(7) {
      ["Monday"]=>
      string(11) "08:00-23:00"
      ["Tuesday"]=>
      string(11) "08:00-23:00"
      ["Wednesday"]=>
      string(11) "08:00-23:00"
      ["Thursday"]=>
      string(11) "08:00-23:00"
      ["Friday"]=>
      string(11) "08:00-23:00"
      ["Saturday"]=>
      string(11) "09:00-23:00"
      ["Sunday"]=>
      string(1) "-"
    }
    ["Delivery"]=>
    array(7) {
      ["Monday"]=>
      string(11) "07:00-21:00"
      ["Tuesday"]=>
      string(11) "07:00-21:00"
      ["Wednesday"]=>
      string(11) "07:00-21:00"
      ["Thursday"]=>
      string(11) "07:00-21:00"
      ["Friday"]=>
      string(11) "07:00-21:00"
      ["Saturday"]=>
      string(11) "07:00-18:00"
      ["Sunday"]=>
      string(1) "-"
    }
  }

[0]=>
array(19)
[0]=> different number of them in the list
There are 120 of them in the list. I only need to get a list of all cities ["City"].
Please, help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Misty Hedgehog, 2016-07-02
@profseo2012

Are you seriously?

foreach ($array as $item) {
  if (isset($item['City'])) {
    echo $item['City'];
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question