search

Home  >  Q&A  >  body text

The execution order of the dividing line

Shouldn’t the code in the function body also be executed in order? Why is the dividing line executed first in the second brother foreach, and executed twice

LostLost2523 days ago1287

reply all(5)I'll reply

  • sky

    sky2018-03-21 15:17:39

    Where is the code?

    reply
    0
  • Lost

    foreach($data as $value){ //The first loop assigns the country array to $value //The second loop assigns the array of Chinese provinces to $value //Therefore, I traverse $value again when looping foreach($value as $k => $v){ echo $k . '-----' . $v .'<br />'; } //In order to see it more clearly, I added a gorgeous dividing line in the middle to facilitate your analysis. echo '----------Separating line-----------<br />'; }

    Lost · 2018-03-21 15:18:30
    sky

    I can't see your overall code clearly? Is your $data a two-dimensional array?

    sky · 2018-03-21 15:35:10
    Lost

    It's two-dimensional, it's the code in the tutorial

    Lost · 2018-03-21 15:55:24
    sky

    I really don't understand what you want to do

    sky · 2018-03-21 17:18:55
  • Cancelreply