title: PHP array two values and call a pair
body: <p>I have something like this:</p>
  
  <pre><code>host1 | port1
  host2 | port2
  host3 | port3
  host4 | port4
  </code></pre>
  
  <p>Now, I need to insert pairs into an array so I can use them in a loop:</p>
  
  <p>I tried to loop through one value of an array</p>
  
  <pre><code>$hosts  = array('host1','host2','host3'); 
  
  foreach ($hosts as $host) {
  
     echo $host;
  
  }
  </code></pre>
  
  <p>How do I add pairs to an array so I can call say <code>host</code> it outputs both host and port?</p>