title: How to attach an attribute to each element in a PHP array
body: <p>Suppose we have an array with one attribute for each element:</p>
  
  <pre><code>Array ( [0] =&gt; A [1] =&gt; B [2] =&gt; C [3] =&gt; D ) 
  </code></pre>
  
  <p>Is it possible to add the same uniform attribute to each of the elements, so that a new  two-dimensional array would be obtained? I.e. for attribute X:</p>
  
  <pre><code>Array ( [0] =&gt; Array ( [0] =&gt; A [1] =&gt; X)
          [1] =&gt; Array ( [0] =&gt; B [1] =&gt; X)
          [2] =&gt; Array ( [0] =&gt; C [1] =&gt; X) )
  </code></pre>
  
  <p>I know, I could do it using for each loop, but is there any more elegant solution (such as array_combine)?</p>
  
  <p>(For assigning different values, please refer to: <a href="https://stackoverflow.com/questions/5906926/assigning-a-value-to-each-array-element-php">Assigning a value to each array element PHP</a>)</p>