Change array key from string to integer value with the array values still intact.

StackOverflow https://stackoverflow.com/questions/21562369

  •  07-10-2022
  •  | 
  •  

سؤال

i am retrieving result as array from the database using codeigniter like this:

Array([name]=>TempName [hobby]=>Programming)

and i would like to change the above array like this:

Array([0]=>Tempname [1]=>Programming)

i would like to change the key(name,hobby) from column name to integer value(0,1)....

i have no idea about this...how i can change the key from string to integer...

any help or suggestion would be a great help, thanks in advance....

هل كانت مفيدة؟

المحلول

In PHP you can use the array_values method http://uk1.php.net/array_values

نصائح أخرى

array_values may be what you are looking for

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top