私は$param
の文字列を大文字に基づいて$chunks
に爆発させることができますか?文字列を大文字で壊しますか?
[A-Z]
に
preg_split()
を使用して
$string = 'setIfUnmodifiedSince';
$method = substr($string, 0, 3);
$param = substr($string, 3);
// Split $param and implode with '-' separator
$chunks = splitAtUpperCase($param); // Chunks are: 'If', 'Unmodified' and 'Since'
$field = implode('-', $chunks); // Get If-Unmodified-Since HTTP field name
私は鉱山を持って前にうーん、JRLは、作業[[先読み](http://www.regular-expressions.info/lookaround.html#lookahead)を提供](http://www.ideone.com/4ux5G):)また、 '$ chucks'と' $ chunks'に気づく – jensgram
私が仮定する正規表現を学ぶ時間。この優雅なソリューションをありがとう! – gremo