Snippets tagged “array-combine”
2 snippets use this tag.
- How do you reindex an array in PHP but with indexes starting from 1?PHP
You can use the array_values function to get a new array with the values of the original array, and then use the array_combine function to create an array using the new values and an indexed array of keys starting from 1:
- How to rename sub-array keys in PHP?PHP
You can use the array_combine function in PHP to create a new array by using one array for the keys and another for the values.