How can I make two numeric arrays
(one for keys one for values – the opposite of array combine)
Source info:
John => Physics, Mary => Medicine, Gary => Drama,
Output to
0=>Physics, 1=>Medicine, 2=>Drama
and
0=>John, 1=>Mary, 2=>Drama
It seems easy, but I’ve had no luck.
Call
array_keys()andarray_values()on your associative array respectively.If for whatever reason you must have numeric indices that start at 1 (as in your original question before any edits), you’ll need to do a little more: