title: PHP Two Arrays Into One Table. First Array Vertical & Horizontal
body: <p><a href="https://i.stack.imgur.com/NylKC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NylKC.png" alt="data"></a></p>
  
  <pre>
  
      $salesman = array (1=>'James',2=>'Linda',3=>'Jorge',4=>'Abudi');
  
  
      $sales = array(
        '0' => array ( 
          'salesman' => '2',
          'retail_date' => '2016-01-01', 
        ), 
        '1' => array (
          'salesman' => '3',
          'retail_date' => '2016-01-01', 
        ), 
        '2' => array (
          'salesman' => '4',
          'retail_date' => '2016-01-15', 
        ), 
        '3' => array ( 
          'salesman' => '1',
          'retail_date' => '2016-01-15',  
        ), 
        '4' => array (
          'salesman' => '3',
          'retail_date' => '2016-01-01', 
        ),
        '5' => array (
          'salesman' => '3',
          'retail_date' => '2016-01-15', 
        ), 
        '6' => array ( 
          'salesman' => '2',
          'retail_date' => '2016-01-15',  
        ), 
        '7' => array (
          'salesman' => '4',
          'retail_date' => '2016-01-01', 
        ),
        '8' => array (
          'salesman' => '3',
          'retail_date' => '2016-01-15', 
        ), 
        '9' => array ( 
          'puskesmas_id' => '2',
          'retail_date' => '2016-01-15',  
        ), 
        '10' => array (
          'salesman' => '2',
          'retail_date' => '2016-01-01', 
        ),
        '11' => array (
          'salesman' => '3',
          'retail_date' => '2016-01-15', 
        ), 
        '12' => array ( 
          'salesman' => '4',
          'retail_date' => '2016-01-15',  
        ),
      );
  
                  $injan = 0;
                  $infeb = 0;
                  $inmar = 0;
                  $inapr = 0;
                  $inmei = 0;
                  $injun = 0;
                  $injul = 0;
                  $inaug = 0;
                  $insep = 0;
                  $inokt = 0;
                  $innov = 0;
                  $indes = 0;
  
            foreach($sales as $key => $val) {
      //          echo '<br />';
                  $retail_date = $val['retail_date'];
                  $timestamp = strtotime($retail_date);
                  $month = date("m", $timestamp);
      //          echo $month;
                  if ($month =='01') {
                      $injan++;
                  } else if ($month =='02'){
                      $infeb++;
                  } else if ($month =='03'){
                      $inmar++;
                  } else if ($month =='04'){
                      $inapr++;
                  } else if ($month =='05'){
                      $inmei++;
                  } else if ($month =='06'){
                      $injun++;
                  } else if ($month =='07'){
                      $injul++;
                  } else if ($month =='08'){
                      $inaug++;
                  } else if ($month =='09'){
                      $insep++;
                  } else if ($month =='10'){
                      $inokt++;
                  } else if ($month =='11'){
                      $innov++;
                  }
  
              }
  
  
  
                  echo '';
                  echo 'SalesmanJanuariFebruariMaret';
                  echo 'April';
                  echo 'Mei';
                  echo 'June';
                  echo 'July';
                  echo 'August';
                  echo 'September';
                  echo 'October';
                  echo 'November';
                  echo 'Desember';
                  echo '';
                  echo 'total'.$injan.'';
                  echo ''.$infeb.'';
                  echo ''.$inmar.'';
                  echo ''.$inapr.'';
                  echo ''.$injun.'';
                  echo ''.$injul.'';
                  echo ''.$inaug.'';
                  echo ''.$insep.'';
                  echo ''.$inokt.'';
                  echo ''.$innov.'';
                  echo ''.$indes.'';
                  echo '';
                  echo '';
  
  
  </pre>
  
  <p>I can only display like this.</p>
  
  <p><a href="https://i.stack.imgur.com/8HOIg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8HOIg.png" alt="enter image description here"></a></p>
  
  <p>I want to make this look</p>
  
  <p><a href="https://i.stack.imgur.com/DrMFo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DrMFo.png" alt="enter image description here"></a></p>