I have a question about add_post_meta and update_post_meta.
When i am using add_post_meta:
add_post_meta($id, 'my_meta_key', 'my_meta_value_1');
add_post_meta($id, 'my_meta_key', 'my_meta_value_2');
add_post_meta($id, 'my_meta_key', 'my_meta_value_3');
It will give me something like that:
Now when i get this data like this:
get_post_meta(42, 'my_meta_key')
I get:
array (size=3)
0 => string 'my_meta_value_1' (length=15)
1 => string 'my_meta_value_2' (length=15)
2 => string 'my_meta_value_3' (length=15)
But i can do this in another way, like this:
update_post_meta(42, 'my_meta_key', [
'my_meta_value_1',
'my_meta_value_2',
'my_meta_value_3',
]);
Then in database i have:
Now when i get this data:
get_post_meta(42, 'my_meta_key', true)
I have same result:
array (size=3)
0 => string 'my_meta_value_1' (length=15)
1 => string 'my_meta_value_2' (length=15)
2 => string 'my_meta_value_3' (length=15)
So I have a question, are either of these two ways of saving data better than the other?
Or either of these methods is better for data retrieval?