title: Create associative array with a static string for values and keys from an array column
body: <p>I have an array object like this:</p>
  <pre><code>Array
  (
      [0] =&gt; stdClass Object
          (
              [id] =&gt; 1
              [name] =&gt; sam
          )
  
      [1] =&gt; stdClass Object
          (
              [id] =&gt; 2
              [name] =&gt; tim
          )
  
      [2] =&gt; stdClass Object
          (
              [id] =&gt; 3
              [name] =&gt; nic
          )
  
  )
  </code></pre>
  <p>And I want to have this:</p>
  <pre><code>Array
  (
      [sam] =&gt; sample text
      [tim] =&gt; sample text
      [nic] =&gt; sample text
  )
  </code></pre>
  <p>My current approach:</p>
  <pre><code>$arr = array();
  
  foreach($multi_arr as $single_arr) {
      $arr[$single_arr-&gt;name] = &quot;sample text&quot;;
  }
  </code></pre>
  <p>Is there a cleaner/better approach than this? Thanks</p>