Answers for "all ways to reduce an array in php"

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

Code answers related to "all ways to reduce an array in php"

Browse Popular Code Answers by Language