- array_map: documentation ( source)
- var_dump: documentation ( source)
- array_merge: documentation ( source)
- array_values: documentation ( source)
- array_keys: documentation ( source)
- json_encode: documentation ( source)
<?php
$attributes = ['Type' => 'MyType'];
$payload = "Frankfurt";
var_dump(['one'=>'two']+['one'=>'three']);
$jobMessage = [
'MessageBody' => json_encode($payload),
'MessageAttributes' =>
array_merge([
"Type" => [
'StringValue' => __CLASS__,
'DataType' => 'String'
]
],
array_values(array_map(
function($name, $value) {
return [
"$name" => [
'DataType' => 'String',
'StringValue' => $value,
]
];
},
array_keys($attributes),
array_values($attributes)
))
)
];
var_dump($jobMessage);