title: setting attribute value to its array key in php
body: <p>(after deleting an XML node) the following gets a list of &lt;picture&gt; 'id' attribute values:</p>
  
  <pre><code>$objXML = new SimpleXMLElement(XML_FILE_NAME, null, true);
  $picture = $objXML-&gt;xpath('picture');
  $arrayCurrent = array();
  foreach($picture as $value) {
      $arrayCurrent[] = (string)$value['id'];
  }
  sort($arrayCurrent); // required as XML nodes not in numerical 'id' order
  print_r($arrayCurrent);
  </code></pre>
  
  <p>Which returns the following:</p>
  
  <p><strong>Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 5 [5] => 6 [6] => 7 [7] => 8 )</strong></p>
  
  <p>I want to set each id to the value of its current key like so:</p>
  
  <p><strong>Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 )</strong> </p>
  
  <p>I've been messing about with this for a while but I wondered if there is a simple way to achieve this?</p>