| @@ 226-233 (lines=8) @@ | ||
| 223 | * @param string $str |
|
| 224 | * @return int |
|
| 225 | */ |
|
| 226 | protected static function longestWordLength($str) |
|
| 227 | { |
|
| 228 | $words = preg_split('/[ -]/', $str); |
|
| 229 | $lengths = array_map(function ($s) { |
|
| 230 | return strlen($s); |
|
| 231 | }, $words); |
|
| 232 | return max($lengths); |
|
| 233 | } |
|
| 234 | } |
|
| 235 | ||
| @@ 180-187 (lines=8) @@ | ||
| 177 | * @param string $str |
|
| 178 | * @return int |
|
| 179 | */ |
|
| 180 | protected static function longestWordLength($str) |
|
| 181 | { |
|
| 182 | $words = preg_split('#[ /-]#', $str); |
|
| 183 | $lengths = array_map(function ($s) { |
|
| 184 | return strlen($s); |
|
| 185 | }, $words); |
|
| 186 | return max($lengths); |
|
| 187 | } |
|
| 188 | } |
|
| 189 | ||