fork download
  1. <?php
  2. $fields = array( "key0" => "value0", "key1" => "value1");
  3. //Get the first key
  4. reset($fields);
  5. $first_key = key($fields);
  6. $first_value = $fields[$first_key];
  7. unset($fields[$first_key]);
  8.  
  9. $fields[$first_key] = $first_value;
  10. var_dump($fields);
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
array(2) {
  ["key1"]=>
  string(6) "value1"
  ["key0"]=>
  string(6) "value0"
}