my array in DB looks like this:
a:2:{i:0;s:6:"first";i:1;s:9:"second";}
So output is like:
1 => first
2 => second
How can I update eg. only 1st value?
Your string in your DB is a serialized array. You first need to unserialize it and then you can modify the values.
a:2:{i:0;s:6:"first";i:1;s:9:"second";}<- this is a value in column meta_value. When I add new position it will be eg.a:3:{i:0;s:6:"first";i:1;s:9:"second";i:2;s:5:"third";}