I need to convert Array keys into a random string, how is it possible ?
This is how my array displays with the keys
I need to display as below by using str_random(5)
array:2 [▼
bataj => 229
akgrt => 228
]
Here's the codes to dump the array
$files = $this->filesRepo->getByUuids($request->photos);
$fileId = $files->pluck('id')->toArray();
dd($fileId);
$keys = array_map(function() {
return str_random(5);
}, $fileId);
$fileId = array_combine($keys, array_values($fileId));
dd($fileId);