Q:

PHP create array where key and value is same

I am using the range() function to create an array.  However, I want the keys to be the same as the value.  This is ok when i do range(0, 10) as the index starts from 0, however if i do range(1, 11), the index will still start from 0, so it ends up 0=>1 when i want it to be 1=>1
How can I use range() to create an array where the key is the same as the value? 

A:

How about array_combine? 
$b = array_combine(range(1,10), range(1,10));

A:

Or you did it this way:
$b = array_slice(range(0,10), 1, NULL, TRUE);

Find the output here: http://codepad.org/gx9QH7ES

