How to loop through the following php array?

后端 未结 2 946
无人及你
无人及你 2021-01-29 16:05

I want to loop through the following array.

array(2)  {
    [0]=> array(6) {
        [0]=> string(10) \"excel_id \"
        [1]=> string(12) \"excel_na         


        
相关标签:
2条回答
  • 2021-01-29 16:36

    If you tried anything at all you should have found foreach. this will loop through all of your array values. You can simply loop through a multi-dimensional array by using a multi-dimensional foreach like this:

    foreach($array as $parentValue)
    {
        foreach($parentValue as $childValue)
        {
            // your code
        }
    }
    
    0 讨论(0)
  • 2021-01-29 16:54

    try this:

    foreach ($main_array as $outer_entry){
    
        foreach($outer_entry as $entity){
            print_r($entity);
        }
    
    }
    
    0 讨论(0)
提交回复
热议问题