note 116933 added to function.array-column
| From: | robbieaverill | Date: | Mon, 23 Mar 2015 19:51:29 +0000 |
| Subject: | note 116933 added to function.array-column | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202018@lists.php.net to get a copy of this message | ||
Another option for older PHP versions (pre 5.5.0) is to use array_walk():
<?php
$array = array(
array('some' => 'var', 'foo' => 'bar'),
array('some' => 'var', 'foo' => 'bar'),
array('some' => 'var', 'foo' => 'bar')
);
array_walk($array, function(&$value, $key, $return) {
$value = $value[$return];
}, 'foo');
print_r($array);
// Array
// (
// [0] => bar
// [1] => bar
// [2] => bar
// )
?>
----
Server IP: 72.52.91.14
Probable Submitter: 203.167.134.229
----
Manual Page -- http://php.net/manual/en/function.array-column.php
Edit -- https://master.php.net/note/edit/116933
Del: integrated -- https://master.php.net/note/delete/116933/integrated
Del: useless -- https://master.php.net/note/delete/116933/useless
Del: bad code -- https://master.php.net/note/delete/116933/bad+code
Del: spam -- https://master.php.net/note/delete/116933/spam
Del: non-english -- https://master.php.net/note/delete/116933/non-english
Del: in docs -- https://master.php.net/note/delete/116933/in+docs
Del: other reasons-- https://master.php.net/note/delete/116933
Reject -- https://master.php.net/note/reject/116933
Search -- https://master.php.net/manage/user-notes.php