title: How to assign variables to array key values
body: <p>I have a code in which the array output the result in correctly but I want to assign variable for each key value getting on output. There are no variable in JSON too . all contains values without description.</p>
  
  <pre><code>&lt;?php
      $trainNumbers = array(12550,12445);
  
      $json      = file_get_contents('advcg.json');
      $trainData = json_decode($json, true);
      foreach ($trainData[0] as $train) {
  
          $trainNumber = $train[0][0];
          if (in_array($trainNumber, $trainNumbers)) {
  
              foreach ($train[0] as $dataField) {
                  echo "{$dataField}\n";          
              }
              echo "\n";
  
          }
      }
  ?&gt;
  </code></pre>
  
  <p>The results comes like </p>
  
  <pre><code>16032
  JAMMU TAWI - CHENNAI CENT Andaman Exp
  2013-04-16
  TMC
  14.606674
  79.997721
  TALAMANCHI
  34
  14.564311
  79.994888
  NLR
  NELLORE
  24
  1
  
  11078
  JAMMU TAWI - PUNE Jhelum Express
  2013-04-17
  BSL
  21.0469912
  75.7883817
  BHUSAVAL JN
  158
  21.0222615
  75.6729054
  JL
  JALGAON JN
  147
  17
  </code></pre>
  
  <p>How can I assign variable (description) to first ,second, third,fourth,.... key values 
  The first key value is train number,trainname,lat,long.... like this.So that it can be iterated for every set in the array object</p>
  
  <p>The desired output like description should be beside the values</p>
  
  <pre><code>train_no-16032
  train_name- JAMMU TAWI - CHENNAI CENT Andaman Exp
  dep_date - 2013-04-16
  dep_station- TMC
  dep_log - 14.606674
  dep_lat - 79.997721
  arr_station- TALAMANCHI
  delay_time- 34
  new_lat- 14.564311
  new_long- 79.994888
  new_station- NLR
  new_station_name- NELLORE
  time_delay- 24
  station_left- 1
  </code></pre>
  
  <p>Any idea on this will be helpful.</p>
  
  <p>Thanks</p>