Following is an object:
$obj = (object) [];
$obj->{'key1'} = 'val1';
Now, how do I push a key with same name but different value?
$obj = (object) [];
$obj->{'key1'} = 'val1';
$obj->{'key1'} = 'val2';
It just edits the key1
. I know this is an expected behavior but do we have other workarounds?
I want the schema to be like:
"collection": {
"obj1": "val1",
"obj1": "val2"
}