Answers for "php array_reduce argument"

1

array reduce associative array php

$assoc_arr = array_reduce($arr, function ($result, $item) {
    $result[$item['text']] = $item['id'];
    return $result;
}, array());
Posted by: Guest on June-18-2021

Browse Popular Code Answers by Language