I went into a problem where I wanted to assign default values to the array indexes that are missing values.
Example,
I have an array like the below,
$a = [0=>'hello', 2=>'hi', 5=>'test'];
Here, indexes 1,3, and 4 are missing. I want to make this array by adding values to the missing indexes the values can be any default value suppose '' an empty space.
The final array should look like the below,
$a = [0=>'hello', 1=>'', 2=>'hi',3=>'', 4=>'', 5=>'test'];
Looking for help to solve this issue.