- var_dump: documentation ( source)
- strtolower: documentation ( source)
- array_walk: documentation ( source)
- ucfirst: documentation ( source)
<?php
function normalizeHeaders(&$headers)
{
// Normalize headers
array_walk(
$headers,
function (&$val, &$key) {
$key = ucfirst(strtolower($key));
$val = ucfirst(strtolower($key)) . ': ' . $val;
}
);
}
$headers = array('foo' => 'bar');
normalizeHeaders($headers);
var_dump($headers);