title: What's the issue in inserting a new array element in existing array in PHP?
body: <p>I'm having an multi dimensional array. Now I want to insert a new key value combination in this array. But I'm not able to do it. Can you help me in achieving this? For your reference i'm giving my code below alongwith the existing multi dimensional array:</p>
  
  <p>Code:
  $practice_sheet_set_data /<em>Existing multi dimensional array</em>/
  /<em>The code for getting the value which is to be inserted in the above array</em>/</p>
  
  <pre><code>$sql  = " SELECT st.staff_full_name FROM ".TBL_STAFF." AS st JOIN ".TBL_PRACTICE_SHEET." AS ps ";
              $sql .= " ON st.staff_id=ps.practice_sheet_created_staff_id WHERE ps.practice_sheet_id= ".$practice_sheet_id;
              $this-&gt;mDb-&gt;Query( $sql);
              $practice_sheet_created_staff_data = $this-&gt;mDb-&gt;FetchArray(MYSQL_FETCH_SINGLE);
  </code></pre>
  
  <p>From tha above code I'm getting an single dimensional array in a variable  <code>$practice_sheet_created_staff_data</code> but not able to insert it's value into a above array. I tried array_push and array_merge too. Both the arrays are given below:</p>
  
  <pre><code>$practice_sheet_data
  
  Array
  (
      [0] =&gt; Array
          (
              [topic_no_questions] =&gt; 5
              [subject_id] =&gt; 21
              [subject_name] =&gt; CPT Quantitative Aptitude
              [topic_id] =&gt; 505
              [topic_name] =&gt; Ratio and Proportion
          )
  
      [1] =&gt; Array
          (
              [topic_no_questions] =&gt; 5
              [subject_id] =&gt; 21
              [subject_name] =&gt; CPT Quantitative Aptitude
              [topic_id] =&gt; 508
              [topic_name] =&gt; Inequalities
          )
  
      [2] =&gt; Array
          (
              [topic_no_questions] =&gt; 5
              [subject_id] =&gt; 21
              [subject_name] =&gt; CPT Quantitative Aptitude
              [topic_id] =&gt; 509
              [topic_name] =&gt; Simple and Compound Interest including Annuity - Applications
          )
  
      [3] =&gt; Array
          (
              [topic_no_questions] =&gt; 5
              [subject_id] =&gt; 21
              [subject_name] =&gt; CPT Quantitative Aptitude
              [topic_id] =&gt; 511
              [topic_name] =&gt; Sequence and Series - Arithmatic and Geomatric Progression
          )
  
      [4] =&gt; Array
          (
              [topic_no_questions] =&gt; 5
              [subject_id] =&gt; 21
              [subject_name] =&gt; CPT Quantitative Aptitude
              [topic_id] =&gt; 517
              [topic_name] =&gt; Statistical Description of Data
          )
  
      [5] =&gt; Array
          (
              [topic_no_questions] =&gt; 5
              [subject_id] =&gt; 21
              [subject_name] =&gt; CPT Quantitative Aptitude
              [topic_id] =&gt; 519
              [topic_name] =&gt; Correlation and Regression
          )
  
      [6] =&gt; Array
          (
              [topic_no_questions] =&gt; 5
              [subject_id] =&gt; 21
              [subject_name] =&gt; CPT Quantitative Aptitude
              [topic_id] =&gt; 520
              [topic_name] =&gt; Probability &amp; Mathematical Expectation
          )
  
      [7] =&gt; Array
          (
              [topic_no_questions] =&gt; 5
              [subject_id] =&gt; 21
              [subject_name] =&gt; CPT Quantitative Aptitude
              [topic_id] =&gt; 521
              [topic_name] =&gt; Theoritical Distributions
          )
  
  )
  
  $practice_sheet_created_staff_data
  
  
  Array
  (
      [staff_full_name] =&gt; Amol Patil
  )
  </code></pre>
  
  <p>I want to create a new key value pair in the previous array as <code>[staff_full_name] =&gt; Amol Patil</code></p>