Would this work?
$result = array_map(function($arr) {
return [
'id' => $arr['id'],
'name' => $arr['name']
];
}, $orig_array);
More Related Contents:
- Deleting an element from an array in PHP
- How to delete object from array inside foreach loop?
- Unsetting array values in a foreach loop [duplicate]
- In PHP, how do you change the key of an array element?
- php $_POST array empty upon form submission
- How to generate in PHP all combinations of items in multiple arrays
- Find a matching or closest value in an array
- What’s the best way to get the last element of an array without deleting it?
- PHP: Access Array Value on the Fly
- Search for a key in an array, recursively
- Get the first N elements of an array?
- Restructure multidimensional array of column data into multidimensional array of row data [duplicate]
- Shorthand for arrays: is there a literal syntax like {} or []?
- PHP combine two associative arrays into one array
- PHP Get Highest Value from Array
- PHP compare array
- PHP syntax for dereferencing function result
- sum specific values in a multidimensional array (php)
- How to GROUP BY and SUM PHP Array? [duplicate]
- Sort a flat, associative array by numeric values, then by non-numeric keys
- Merge arrays of associative arrays by shared column values
- How do I declare a two dimensional array?
- str_replace with array
- How to get array key from corresponding array value?
- How to force Doctrine to update array type fields?
- Combine two 2d arrays and have duplicate rows removed
- How to iterate through a nested stdClass? [duplicate]
- How to get the object or class name?
- Group array data on one column and sum data from another column to form a flat associative array
- Convert delimited string into array key path and assign value