I have done a lot of research on google about it but I don't know how to achieve that in PHP. Actually I have an array with values and for each values I would like to get 5 new values incremented of 1.
Exemple :
$valueseg = array( 0 => 2510 , 1 => 1700);
I would like to get this result :
$valueseg = array( 0 => 2510, 1 => 2511, 2 => 2512, 3 => 2513, 4 => 2514 , 5 => 2515, 6 => 1700, , 7 => 1701, , 8 => 1702, , 9 => 1703, 10 => 1704 , 11 => 1705);
I tried to do that with a foreach and a for loop but I can't retrieve an array.
$tabasc = array();
foreach($valueseg as $key => $value){
for($i = 0; $i < 5; $i++){
$tabasc[$i] = $value + $i ;
}
}
With an echo inside the for loop I have a result inline like this : 2478247924802481248225102511251225132514
And if I try to do a var_dump of $tabasc it shows me values incremented of 1 only for the first value of $valueseg.
Do you know how to do that ?
Thanks
$tabasc[] = $value + $i ;Then you won't overwrite the previous values.