What your asking for is impossible, as when you assign the array like this:
$r1 = array('Hello','World');
PHP will assign "Hello" to the key 0 and "World" to the key 1.
With other words they will have keys assigned to them.
This means that as long as you allow integer keys to be counted as "assigned" keys, there is no way to differentiate if it was a key you set yourself, or if it was auto assigned.
In the event that you do only count string keys as assigned ones, then you can easily just check the key to see if it is a string or integer and if its an integer to use the value for key.