- array_map: documentation ( source)
- array_combine: documentation ( source)
- var_export: documentation ( source)
<?php
$valores = [
["1","1","1","1"],
["2","2","2","2"]
];//array of values
$keys = ['k1','k2','k3','k4']; //array of keys
$id = ['SpecialKey' => 'SpecialValue'];//new array of items I want to add
var_export(
array_map(
fn($row) => array_combine($keys, $row) + $id,
$valores
)
);