I have an array like this (PHP Code):
$my_arr=array(0=>"Joe",1=>"Mike",2=>"Simo","Peter"=>"35", 3=>"Ben" , "Ben"=>"37", 4=>"Nik" , "Joe"=>"43");
I want just get values specific range of index and replace previous arrays values with these new values.Something like this:
$rang= 0-4 OR 0,1,2,3,4 //range of index values.
$my_arr= filtered array value in range index of $range.
I want get this result:
$my_arr=array(0=>"Joe",1=>"Mike",2=>"Simo", 3=>"Ben" , 4=>"Nik");
How should I do this?
Update:
I just want to separate the values of the array($my_arr) that are within the range of the specified number of indexes and everywhere in the array and replace all previous array($my_arr) values with these new values.
**
If there were not some of the indexes, Other indexes outside of the specified range for index numbers should not be replaced and only return values of indexes between 0 and 4($my_arr[0]....$my_arr[4]) , and if they don't have value leave empty or do not return something else