note 118187 added to function.array-map
| From: | shabeerksbr at hotmail dot com | Date: | Thu, 22 Oct 2015 19:50:38 +0000 |
| Subject: | note 118187 added to function.array-map | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204005@lists.php.net to get a copy of this message | ||
Array
(
[result] => Array
(
[0] => Array
(
[child] => Array
(
[5629378c2bad8cac1900002a] => Array
(
[_id] => MongoId Object
(
[$id] => 5629378c2bad8cac19000029
)
[name] => Category 1
[hasChild] => 0
)
[562937c02bad8ca41900002a] => Array
(
[_id] => MongoId Object
(
[$id] => 562937c02bad8ca419000029
)
[name] => Category 1
[hasChild] => 0
)
[562937dd2bad8c9c1900002b] => Array
(
[_id] => MongoId Object
(
[$id] => 562937dd2bad8c9c1900002a
)
[name] => Category 1
[hasChild] => 0
)
)
)
)
[ok] => 1
)
Trim above code neatly using
print_r(array_map(null, $result['result'][0]['child']));
Array
(
[5629378c2bad8cac1900002a] => Array
(
[_id] => MongoId Object
(
[$id] => 5629378c2bad8cac19000029
)
[name] => Category 1
[hasChild] => 0
)
[562937c02bad8ca41900002a] => Array
(
[_id] => MongoId Object
(
[$id] => 562937c02bad8ca419000029
)
[name] => Category 1
[hasChild] => 0
)
[562937dd2bad8c9c1900002b] => Array
(
[_id] => MongoId Object
(
[$id] => 562937dd2bad8c9c1900002a
)
[name] => Category 1
[hasChild] => 0
)
)
----
Server IP: 72.52.91.14
Probable Submitter: 117.202.134.248
----
Manual Page -- http://php.net/manual/en/function.array-map.php
Edit -- https://master.php.net/note/edit/118187
Del: integrated -- https://master.php.net/note/delete/118187/integrated
Del: useless -- https://master.php.net/note/delete/118187/useless
Del: bad code -- https://master.php.net/note/delete/118187/bad+code
Del: spam -- https://master.php.net/note/delete/118187/spam
Del: non-english -- https://master.php.net/note/delete/118187/non-english
Del: in docs -- https://master.php.net/note/delete/118187/in+docs
Del: other reasons-- https://master.php.net/note/delete/118187
Reject -- https://master.php.net/note/reject/118187
Search -- https://master.php.net/manage/user-notes.php