$array = array(
array(
'id' => 1,
'first_name' => 'testOne',
),
array(
'id' => 333,
'first_name' => 'test333',
)
);
必需的输出:
array("1_testOne","333_test333");
答案 0 :(得分:1)
这应该有帮助-
array_map(function($a) {
return implode('_', $a); // implode all with '_'
}, $array);
答案 1 :(得分:0)
$array = array(
array(
'id' => 1,
'first_name' => 'testOne',
),
array(
'id' => 333,
'first_name' => 'test333',
)
);
$new_array = [];
foreach($array as $key => $value) {
$new_array[] = $value['id'] . "_" . $value['first_name'];
}
echo "<pre>";
print_r($new_array);
它将返回输出为
Array('1_testOne', '333_test333')