title: adding additional data to array
body: <p>I build up an array like so from a SimpleXML Object like so</p>
  
  <pre><code>$currentXML = new \SimpleXMLElement($getCurrentXML);
  $leadArray = array();
  
  foreach($currentXML-&gt;Job-&gt;Employee as $object) {
      $dataArray[] = array(
          'ID' =&gt; (string)$object-&gt;ID,
          'Date Identified' =&gt; $dateIdentified,
          'Name' =&gt; (string)$object-&gt;Name,
          'Owner' =&gt; (string)$object-&gt;Owner-&gt;Name,
          'Value' =&gt; (string)$object-&gt;EstimatedValue
      );
  }
  </code></pre>
  
  <p>If I output the data for the above, I get something like this which is perfect</p>
  
  <pre><code>array:8 [▼
    0 =&gt; array:7 [▼
      "ID" =&gt; "1230279"
      "Date Identified" =&gt; "19/04/2016"
      "Name" =&gt; "Some Name"
      "Owner" =&gt; "Some Owner"
      "Value" =&gt; "Some Value"
    ]
    1 =&gt; array:7 [▶]
    2 =&gt; array:7 [▶]
    3 =&gt; array:7 [▶]
    4 =&gt; array:7 [▶]
    5 =&gt; array:7 [▶]
    6 =&gt; array:7 [▶]
    7 =&gt; array:7 [▶]
  ]
  </code></pre>
  
  <p>Now within the above foreach loop, I need to use $object->ID to query another API.  SO I have</p>
  
  <pre><code>foreach($currentXML-&gt;Job-&gt;Employee as $object) {
      $dataArray[] = array(
          'ID' =&gt; (string)$object-&gt;ID,
          'Date Identified' =&gt; $dateIdentified,
          'Name' =&gt; (string)$object-&gt;Name,
          'Owner' =&gt; (string)$object-&gt;Owner-&gt;Name,
          'Value' =&gt; (string)$object-&gt;EstimatedValue
      );
  
      $customField = Helper::getCustomFields((string)$object-&gt;ID);
      $currentFieldsXML = new \SimpleXMLElement($customField);
  }
  </code></pre>
  
  <p>Now if I output currentFieldsXML, sometimes I am returned and empty SimpleXMLElement Object, sometimes it contains data.
  What I am trying to do is push the data into the array alongside its other data.  So I have this</p>
  
  <pre><code>foreach($currentXML-&gt;Job-&gt;Employee as $object) {
      $dataArray[] = array(
          'ID' =&gt; (string)$object-&gt;ID,
          'Date Identified' =&gt; $dateIdentified,
          'Name' =&gt; (string)$object-&gt;Name,
          'Owner' =&gt; (string)$object-&gt;Owner-&gt;Name,
          'Value' =&gt; (string)$object-&gt;EstimatedValue
      );
  
      $customField = Helper::getCustomFields((string)$object-&gt;ID);
      $currentFieldsXML = new \SimpleXMLElement($customField);
  
      if(!empty($currentFieldsXML-&gt;CustomFields)) {
          foreach($currentFieldsXML-&gt;CustomFields as $custom) {
              array_push($dataArray, (string)$custom-&gt;CustomField-&gt;ID);
              array_push($dataArray, (string)$custom-&gt;CustomField-&gt;Name);
              array_push($dataArray, (string)$custom-&gt;CustomField-&gt;Text);
          }
      }
  }
  </code></pre>
  
  <p>The problem with this is that the output is something like this</p>
  
  <pre><code>array:23 [▼
    0 =&gt; array:7 [▶]
    1 =&gt; array:7 [▶]
    2 =&gt; "122156"
    3 =&gt; "Some Data"
    4 =&gt; "Some more Data"
    5 =&gt; array:7 [▶]
    6 =&gt; "122156"
    7 =&gt; "Date"
    8 =&gt; "20 April"
  ]
  </code></pre>
  
  <p>So element 0 has no custom fields associated with it.  Element 1 does have data, but it is displaying as element 2, 3 and 4.  In essence, the above
  should look something like this</p>
  
  <pre><code>array:8 [▼
    0 =&gt; array:7 [▶]
    1 =&gt; array:7 [▼
      "ID" =&gt; "1230279"
      "Date Identified" =&gt; "19/04/2016"
      "Name" =&gt; "Some Name"
      "Owner" =&gt; "Some Owner"
      "Value" =&gt; "Some Value"
      array:3 [
        1 =&gt; "122156"
        2 =&gt; "Some Data"
        3 =&gt; "Some more Data"
      ]
    ]
    ...
  ]
  </code></pre>
  
  <p>So how can I add the data I am returned into its appropiate array as shown above?</p>
  
  <p>Thanks</p>
  
  <p><strong>UPDATE</strong>
  Sorry, my mistake</p>