How to select only one column in an array
P粉410239819
P粉410239819 2023-09-03 13:47:01
0
1
514
<p>I have an array like below in laravel and I want to extract the columns in it. </p> <pre class="brush:php;toolbar:false;">Array ( [0] => Array ( [table] => form_identification [column] => region ) [1] => Array ( [table] => form_identification [column] => province ) )</pre> <p>I want the output to be as follows</p> <pre class="brush:php;toolbar:false;">Array ( [0] => Array ( [column] => region ) [1] => Array ( [column] => province ) )</pre></p>
P粉410239819
P粉410239819

reply all(1)
P粉575055974

Treat your first array as a $datas variable, we will use foreach to loop over the entire array

foreach($datas as $data) {
    $result[] = array('column' => $data['column']);
}
print_r($result);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!