I have an array in php
Contents of array are
print_r($room_array);
Array ( [1] => 102 );
Now how do I change the value of index 1 to index 0
I have an array in php
Contents of array are
print_r($room_array);
Array ( [1] => 102 );
Now how do I change the value of index 1 to index 0
First this is a very unclear question but this is what I think will solve your problem.
foreach($room_array as $key=>$value) {
unset($room_array[$key]);
$room_array[0] = $value;
}
I know this is a very hard coded and not scalable script, but the question is very unclear.
you can use :
print_r([...$room_array]);
or
print_r(array_values($room_array));
Regards,