I have an array as the following:
function example() { /* some stuff here that pushes items with dynamically created key strings into an array */
use array_keys() to get an array of all the unique keys.
array_keys()
Note that an array with named keys like your $arr can also be accessed with numeric indexes, like $arr[0].
$arr
$arr[0]
http://php.net/manual/en/function.array-keys.php