phparraysmultidimensional-array

how to echo multidimensional array using foreach?


How to echo multidimensional array using php. curruntly its print only one value but instead of this i want to print all values which is contains in my $data

  $data = $_POST['allValues'];

            foreach($data as $k=>$v)
            {    
            echo $data[$k][1];
            }

Solution

  • You can do something like this :-

    $data = $_POST['allValues'];
    
            foreach($data as $key)
            {    
               foreach($key as $value)
               {
                   echo $value;
               }
            }