I am new to postgresql with php. I get below array using pg_fetch_array() function.
Array
(
[0] =>
[name] =>
[1] => 1
[status] => 1
[2] => C2005
[code] => C2005
)
after removing index 1
and value of key status
, i have to reindex this array so that expected output should become like:
Array
(
[0] =>
[name] =>
[1] => C2005
[code] => C2005
)
I tried
unset($row[1]);
unset($row['status'];
$foo = array_values($row);
echo "<pre>";
print_r($foo)
echo "</pre>";
and got output
Array
(
[0] =>
[name] =>
[2] => C2005
[code] => C2005
)
How the numeric index can be re-indexed after removing particular keys from the array?