Last active
December 21, 2015 20:00
-
-
Save eljamez/6358636 to your computer and use it in GitHub Desktop.
Revert Array to default numbering system for arrays.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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