I want to chunk json by it's value using PHP. Here sample json is
{
"16506": "10",
"16507": "10",
"16508": "10",
"16509": "10",
"16510": "20",
"16511": "20",
"16512": "20",
"16513": "30"
}
my expectation is to format like
10=>[16506,16507,16508,16509]
20=>[16510,16511,16512]
30=>[16513]
Is there any built-in function is php or have to use loop ? here I used json_decode() and array_flip(). But array_flip makes it distinct. Thanks in advance
foreachwill suffice...