title: creating a array with index value dynamically in php
body: <p>hi i want to create an array dynamically with the index value and the key value.</p>
  
  <p>here $head is the array name and $values is the key value   </p>
  
  <pre><code>$head = Array ( [0] =&gt; Dis_id [1] =&gt; Dis_Desc [2] =&gt; Dis_Per [3] =&gt; Dis_val ) 
  $values = Array ([0] =&gt; Dl-Dis1  [1] =&gt; Discount [2] =&gt; 7.500 [3] =&gt; 26.25 ) 
            Array ([0] =&gt; Dl-Dis2 [1] =&gt; Discount [2] =&gt; 2.500 [3] =&gt; 73.13 )
  
  foreach($values as $valu =&gt; $key)
         {
           $value = $value + array($head[$valu]=&gt;$key.",");
         }
  echo '&lt;pre&gt;';
  print_r($value);
  </code></pre>
  
  <p>The output will be as</p>
  
  <pre><code> Array
  (
  [Dis_id] =&gt; Dl-Dis2,
  [Dis_Desc] =&gt; Discount,
  [Dis_Per] =&gt; 2.500,
  [Dis_val] =&gt; 73.13,
  )
  </code></pre>
  
  <p>But the output i need is as follows</p>
  
  <pre><code>Array
  (
  [Dis_id] =&gt; Dl-Dis1,
  [Dis_Desc] =&gt; Discount,
  [Dis_Per] =&gt; 7.500,
  [Dis_val] =&gt; 26.25,
  )    
  Array
  (
  [Dis_id] =&gt; Dl-Dis2,
  [Dis_Desc] =&gt; Discount,
  [Dis_Per] =&gt; 2.500,
  [Dis_val] =&gt; 73.13,
  )
  </code></pre>
  
  <p>i dont know how to do please help me</p>
  
  <p>update to get my output</p>
  
  <pre><code>$values = array(array (0 =&gt; 'Dl-Dis1',  1 =&gt; 'Discount', 2 =&gt; 7.500, 3 =&gt; 26.25 ), array (0 =&gt; 'Dl-Dis2', 1 =&gt; 'Discount', 2 =&gt; 2.500, 3 =&gt; 73.13 )) ;
  </code></pre>
  
  <p>thank u all</p>