language: PHP (php 5.4.4)
date: 546 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
 
function toHttpField($s) {
        return preg_replace('/(?<!^)([A-Z])/', '-\\1', $s);
}
 
$tests = array(
        'IfModifiedSince',
        'imSomethingWeird',
        'Location',
        'AcceptLanguage'
);
 
foreach ($tests as $t) {
        printf("toHttpField('%s'); // %s\n", $t, toHttpField($t));
}