Return values as keys in a new array

awt

New Member
I have a PHP array.\[code\]array 0 => int 1 1 => int 13 2 => int 16 3 => int 17 4 => int 18\[/code\]What I want returned is a new array like this:\[code\]array(1, 13, 16, 17, 18)\[/code\]ie. The values are now keys of a new arrayI've tried \[code\]array_flip\[/code\], but I need to drop the values.I've googled around and there doesn't seem to anything that relates.If someone could point me to the right direction or provide a better solution, it would be much appreciated. EDIT:\[code\]array_flip\[/code\] returns:\[code\]array 1 => int 0 13 => int 1 16 => int 2 17 => int 3 18 => int 4\[/code\]What I want is just: \[code\]array(1, 13, 16, 17, 18)\[/code\]. Am I understanding this wrong? Does the output I want actually have null values on each key?
 
Back
Top