Skip to content

Instantly share code, notes, and snippets.

@eljamez
Last active December 21, 2015 20:00
Show Gist options
  • Save eljamez/6358636 to your computer and use it in GitHub Desktop.
Save eljamez/6358636 to your computer and use it in GitHub Desktop.
Revert Array to default numbering system for arrays.
// usage
// just call rekey_array_keys_to_defaults( $my_array );
// this function call will return the same array in the same order
// but with new keys. The new keys are the default array keys
// i.e. [0,1,2]
function rekey_array_keys_to_defaults($array_to_rekey) {
$rekeyed_array = array();
foreach ($array_to_rekey as $key => $value) {
array_push($rekeyed_array, $value);
}
return $rekeyed_array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment