Skip to content
Advertisement

Tag: array-map

How use array_map for order by word in php

I have this two-dimensional array And I would like this result: I am a beginner, so there may be things that are not done this way. Please understand 😉 I know how to run two foreach one inside the other and look for matches, but I think an array map would be faster and cleaner, right? Maybe I’m wrong about

How to map a 2D array to 1D array in PHP

I can’t figure out how to do the following array_map in php. Any help is much appreciated. Input: Desired Output: What I have so far: Here I am mapping to an array and I know it’s not what I want but I can not figure out if there is some syntax for me to return just $x[‘slug’] => $x[‘name’] without

Advertisement